Hi, developers! I’m extremely new to this stuff, and I’m having some trouble with my script:
So I want to kick a specific player that clicks on a specific TextButton within a frame. For some reason though, my code (in a LocalScript within the TextButton) isn’t working:
local plr = game.Players:GetPlayers()
plr:Kick("You have been kicked for not accepting the rules.")
I looked in the “Player:Kick” page of the Developer Hub, but couldn’t quite comprehend it. Any help?
Players:GetPlayers() returns a table of players, and that table doesn’t come with a
You could do it like
game.Players.LocalPlayer:Kick('You got kicked')
game.Players.LocalPlayer would find your player (kinda)
So I said:
local plr = game.Players.LocalPlayer
And it worked! Thanks!
Yes, that is correct. Just make sure it is a local script.
Thank you! I see this is an alternate way to do it.