debris = game:GetService("Debris") function thread(func) Spawn(func, 0) end unit = 6 function onPlayerEntered(player) local chats = 1 local warns = 2 player.Chatted:connect(function (msg, rec) chats = chats + 1 end) while player.Parent do chats = 0 wait(unit) if chats > 1*unit and chats < 2*unit then if warns > 2 then player:kick() else local m = Instance.new("Message", player:FindFirstChild("PlayerGui")) m.Text = "If You Flood The Chat Again, You Will Be Kicked Automatically." debris:AddItem(m, 3) warns = warns + 1 end elseif chats >= 2*unit then player:kick() end end end game.Players.PlayerAdded:connect(onPlayerEntered)
Try changing line 28 in that code block to this:
Game.Players.ChildAdded:connect(function(plr) if plr:IsA("Player") then onPlayerEntered(plr) end end)
Like RedCombee said, PlayerAdded
doesn't fire in LocalScripts.
I added it to my main, anyways, thanks for letting me know :)