Anomaly Detection
Key Required

Anomaly Detection

Scary Shawarma Kiosk: the ANOMALY [horror]p1bubp1bub 7.4K views 106 executesUpdated Dec 13, 2025
2.5/ 5(2 votes)
1150% Positive
Lua Script•103 lines (2843 chars)
local Workspace = game:GetService("Workspace")
local StarterGui = game:GetService("StarterGui")

local humFolder = Workspace:WaitForChild("Hum")
local notifiedAnomalies = {}
local connections = {}

local function isAnomalyModel(model)
    if not model:IsA("Model") then
        return false
    end
    local anomalyValue = model:FindFirstChild("Anomaly")
    return anomalyValue and anomalyValue:IsA("BoolValue") and anomalyValue.Value
end

local function sendAnomalyNotification(anomalyModel)
    if notifiedAnomalies[anomalyModel] then
        return
    end
    
    notifiedAnomalies[anomalyModel] = true
    
    -- Use pcall to prevent errors if SetCore isn't ready
    local success, err = pcall(function()
        StarterGui:SetCore("SendNotification", {
            Title = "⚠️ Anomaly Detected!",
            Text = "Anomaly (" .. anomalyModel.Name .. ") has appeared!",
            Icon = "rbxassetid://6031071053", -- Warning icon
            Duration = 5,
        })
    end)
    
    if not success then
        warn("Failed to send notification:", err)
    end
end

local function monitorBoolValue(model, anomalyValue)
    if connections[anomalyValue] then
        return
    end
    
    connections[anomalyValue] = anomalyValue.Changed:Connect(function(newValue)
        if newValue then
            sendAnomalyNotification(model)
        else
            -- Reset notification when anomaly is deactivated
            notifiedAnomalies[model] = nil
        end
    end)
    
    if anomalyValue.Value then
        sendAnomalyNotification(model)
    end
end

local function setupModelMonitoring(model)
    if not model:IsA("Model") then
        return
    end
    
    local anomalyValue = model:FindFirstChild("Anomaly")
    if anomalyValue and anomalyValue:IsA("BoolValue") then
        monitorBoolValue(model, anomalyValue)
    end
    
    if not connections[model] then
        connections[model] = model.ChildAdded:Connect(function(child)
            if child.Name == "Anomaly" and child:IsA("BoolValue") then
                monitorBoolValue(model, child)
            end
        end)
    end
end

local function cleanupModel(model)
    notifiedAnomalies[model] = nil
    
    if connections[model] then
        connections[model]:Disconnect()
        connections[model] = nil
    end
    
    local anomalyValue = model:FindFirstChild("Anomaly")
    if anomalyValue and connections[anomalyValue] then
        connections[anomalyValue]:Disconnect()
        connections[anomalyValue] = nil
    end
end

for _, child in ipairs(humFolder:GetChildren()) do
    setupModelMonitoring(child)
end

humFolder.ChildAdded:Connect(function(child)
    task.defer(function() -- Wait for model to fully load
        setupModelMonitoring(child)
    end)
end)

humFolder.ChildRemoved:Connect(function(child)
    cleanupModel(child)
end)

Features & Information

Memory cleanup Better performance over time Late loading No missed anomalies Re-notification Players always stay informed Error handling Script never crashes Visual icon Better user experience Race condition fix More reliable detection
#AnomalyDetection Notification Monitoring Event

Community Comments (6)

SrpterSrpterDec 16, 2025

Nice tho

W7sScriptTimeW7sScriptTimeDec 17, 2025

W script👍🏻👍🏻😺,but some anomalies can't be detected, i hope you improve it

WlazedWlazedDec 17, 2025

the description is too formal like its Ai :/ But nice script

Replying to @Wlazed
p1bubp1bubDec 17, 2025

@QWERAW Actually, if it's made with AI, it's because I created this https://scriptblox.com/script/Universal-Script-ScAgent-AI-TEST-73377 to create scripts, and this is more of a test I did.

WlazedWlazedDec 17, 2025

Yo some anomalies isnt detected when i see ts ghost behind me

duongsieudeptraiduongsieudeptraiDec 18, 2025

not work huhu

More Scripts for Scary Shawarma Kiosk: the ANOMALY [horror]