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

My kick on click text button script isn't working?

I am trying to make a script for a text button in a GUI that when pressed will kick the player from the game, this is what I have but it's not working.

local localplayer = game.Players.LocalPlayer

script.Parent.TextButton.MouseButton1Click:Connect(function(plr)
	plr:Kick(localplayer)
end)

1 answer

✓ Accepted answer

the parameters of the :Kick() function is the message of the kick, not the player. Also MouseButton1Click holds no parameters, so use the LocalPlayer which you have defined.

local localplayer = game.Players.LocalPlayer

script.Parent.TextButton.MouseButton1Click:Connect(function()
    localplayer:Kick("hacker") 
end)

:Kick()

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