Hello!
I have a script that supposedly bans people upon death, I tried it out and it doesn’t seem to work. The regular screen appears “You were kicked from this experience: You’ve been banned! (Error Code:267)” But upon joining the game again, you are still able to play just like regular. I am very new to scripting, so I am not too sure what is going on. The output shows no errors.
Here is the code:
game.Players.PlayerAdded:Connect(function(p)
-- when they die, save their name and kick them
p.CharacterAdded:Connect(function(char)
char.Humanoid.Died:Connect(function()
local c = script.BannedUser:Clone()
c.Value = p.Name
c.Parent = script
wait(1)
p:Kick("You've been banned!")
end)
end)
-- if they rejoin and they've been banned, kick them again
for i,v in pairs(script:GetChildren()) do
if v.Value == p.Name then
p.Kick("You've been banned!")
end
end
I have a StringValue ‘Banned User’ attached to the script, if that helps provide information
Thank you, and all help is welcome!