Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why does my floodcheckwarning Not Working?

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

1 comment

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.

1 answer

✓ Accepted answer

Roblox does this by default.

This discussion is preserved as it was. New answers, comments, and votes are closed.