Stuck On Kick GUI

I’m trying to create a Kick GUI but it doesn’t seem to work.

Main Script

local player = game.Players.LocalPlayer

--//Kick System
local KickUser = script.Parent.KickBox.Text
script.Parent.KickButton.Activated:Connect(function()
	game.Players(KickUser):Kick()
end)

If you know what’s wrong please tell me! Thanks :smiley:

I’m not sure what you’re trying to achieve with this line:

Would TextBox.InputEnded achieve what you’re trying to do?

Make sure that you are defining KickUser within the Event, otherwise it will remain unchanged.

That line detects if a TextButton is activated. Then, calls a function.

Just realized that, my bad.

Do try this though:

1 Like

Don’t forget this code is being run in a LocalScript, the Kick line needs to be run from the server.

Use a Remote Event to achieve this.

1 Like

Well, now that it was edited to actually :Kick() the Player, yes. Beforehand he simply wanted to print the inputted name.

2 Likes

Wow. So simple by just putting the KickUser into the event. Tysm lol

1 Like