Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why using a textbox to kick is not responding?

Asked by 4 years ago

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.

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 trustydoggy 24 — 4y
0
Yes you do need a remote event Frostbyte3337372 42 — 4y
0
Thanks! trustydoggy 24 — 4y

Answer this question