Kick script is kicking myself?
I have an admin GUI stored in server storage, to keep it safe from exploiters.
When a player joins, my system figures out the roles, then clones it into my gui.
In that admin GUI, there is a simple kick script.
(The event is in the GUI)
~~~~~~~~~~~~~~~~~
script.Parent.RemoteEvent.OnServerEvent:Connect(function(plrName, Reason, returnPlr)
plrName = tostring(plrName)
Reason = tostring(Reason)
local Success, Error = pcall(function()
local plrID = game.Players:GetUserIdFromNameAsync(plrName)
01 | local plr = game.Players:GetPlayerByUserId(plrID) |
07 | script.Parent.Callback:FireClient(returnPlr, "Successfully kicked " ..plrName) |
09 | script.Parent.Callback:FireClient(returnPlr, "Invalid" ) |
14 | script.Parent.Callback:FireClient(returnPlr, "Error | Devs Check Console" ) |
end)
~~~~~~~~~~~~~~~~
What the event returns is the player's name and reason. These all return the correct things. But no matter what I do, I cannot kick another player. It kicks me for an unspecified reason.
I came with no errors, it returns the plrname and reason correctly.
What am I doing wrong?
Thanks in advance
Signed - Cheslin23t