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)
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)