Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why does my floodcheckwarning Not Working?

Asked by
s_21 74
8 years ago
local StarterGui = game:GetService("StarterGui")
local player = game:GetService("Players").LocalPlayer
local muteLength = tonumber(script.Name)

StarterGui:SetCoreGuiEnabled('Chat',false)
wait(muteLength)
StarterGui:SetCoreGuiEnabled('Chat',true)

script:Destroy()

And Before you ask, Yes i do have a main script, I think is working! this is my main Script:

local muteAt = 10 
local muteDuration = 60 
local timePeriod = 40   
if script.Parent == workspace then 
    script.Parent = game:GetService("ServerScriptService")
end

local Players = game:GetService("Players")
local chatBucket = {}

function mute(player)
    local character = player.Character
    if character and not character:FindFirstChild("FloodcheckWarning") then
        local warning = script:FindFirstChild("FloodcheckWarning"):Clone()
        warning.Name = tostring(muteDuration)
        warning.Disabled = false
        warning.Parent = character
    end
end

function onChatted(player)
    local chats = (chatBucket[player] or 0) + 1
    if (chats > muteAt) then
        mute(player)
    end
    chatBucket[player] = chats
end

function onPlayerAdded(player)
    player.Chatted:connect(function(msg)
        onChatted(player)
    end)
end

Players.PlayerAdded:connect(onPlayerAdded)

while wait(timePeriod) do
    chatBucket = {}
end
0
"My script doesn't work" isn't sufficent to help us locate where the problem is occurring.  What is suppose to happen that isn't? Try using some print statements to help narrow down the problem. BlackJPI 2658 — 8y

1 answer

Log in to vote
0
Answered by
Voltoxus 248 Moderation Voter
8 years ago

Roblox does this by default.

Ad

Answer this question