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

[Answerd by myself] Why isn't my admin script working!? There are no errors. Please help!.

Asked by 3 years ago
Edited 3 years ago

So I want to make a admin script, but the kick command doesn't work.

Code (server) :

local remoteEvent = game.ReplicatedStorage:WaitForChild("Admin")

remoteEvent.OnServerEvent:Connect(function(action, target)
    print("1")
    if action == "Kick" then
        print("Kicking..")
        print(target)
        print(action)
        game.Players[target]:Kick()
        print("Target Kicked")
    end
end)

Code (local) :

local remoteEvent = game.ReplicatedStorage:WaitForChild("Admin")
local targetPlayer = script.Parent.TextLabel.Text

-------------------------------Kick-------------------------------
local kickBtn = script.Parent.Kick
kickBtn.MouseButton1Up:Connect(function()
    remoteEvent:FireServer("Kick", targetPlayer)
end)

Output: 1

If you have any questios ask me in the comments.

1 answer

Log in to vote
-1
Answered by 3 years ago

I found out the answer.

0
k CaIcuIati0n 246 — 3y
0
lol Zeuxulaz 148 — 3y
Ad

Answer this question