I made a script that checks you KOs to make sure people are not exploiting them. It works when I do:
wait(3)
script.Parent = game.Players.xXGokyXx
if true then
Player = script.Parent.Name
Kills = 0
PrevKills = 0
function onChanged()
Kills = game.Players[Player].leaderstats.KOs.Value
print(Kills-PrevKills)
if Kills - PrevKills > 3 then
game.Players[Player]:Kick("Kicked for exploit killing")
else
PrevKills = Kills
end
end
game.Players[Player].leaderstats.KOs.Changed:Connect(onChanged)
end
But then this does not work:
wait(1)
local Players = game:GetService("Players")
if script.Parent.Name == "ServerScriptService" then
Players.PlayerAdded:Connect(function(player)
local ak = script:Clone()
ak.Parent = game.Players[player.Name]
end)
end
if script.Parent.Name == "Players" then
Player = script.Parent.Name
Kills = 0
PrevKills = 0
function onChanged()
Kills = game.Players[Player].leaderstats.KOs.Value
print(Kills-PrevKills)
if Kills - PrevKills > 3 then
game.Players[Player]:Kick("Kicked for exploit killing")
else
PrevKills = Kills
end
end
game.Players[Player].leaderstats.KOs.Changed:Connect(onChanged)
end
local Players = game:GetService("Players")
Both are in ServerScriptService and neither return errors. I tried some other stuff but nothing else worked. How would I make it clone the script and still work? Both scripts go to the right place as well.

7 comments
I never said it was required. I recommended that he do it.
Heh. You aren't using local functions. Great job.
And I mean that with extreme irony.
You should be using locales always. Your comment is cancer so im deleting it
Thanks @incapaxx
You could has just said the parent thing was it but thanks for all the other stuff I guess.
Also it still doesn't work @Conmmander