Hello,i wanted to make a kick gui in which you put a user name in a textbox and press a button to kick it,the problem is that when I press it,it doesn't respond nor shows an error in the output.

The code for the kick gui is this one:

script.Parent.MouseButton1Click:Connect(function()
	local check = game.Players:FindFirstChild(script.Parent.Parent.Player.Text)
	if check then
	check:Kick("You got kicked from the server.")
	script.Parent.Parent.Player.Text = "Success!"
	
	end
end)

And the button to "Ban in server"

blacklist = require(game.ServerScriptService.BlacklistInServer)

script.Parent.MouseButton1Click:Connect(function()
	local check = game.Players:FindFirstChild(script.Parent.Parent.Player.Text)
	if check then
	check:Kick("You got banned from the server.")
	table.insert(blacklist,check.Name)
	script.Parent.Parent.Player1.Text = "Success!"
	
	end
end)

Optional part: If you are curious about the "Blacklist in server" script is a module script:

local blacklist = {

}

return blacklist

Do i need to use a remote event or something like it? Thanks.

3 comments

0

Is my fault that in the "Ban from server" script i typed Player1 instead of Player,anyways,that will not fix this problem,so don't mark it

0

Yes you do need a remote event

0

Thanks!