I am making an admin script that when a certain button is pressed, it will teleport the person who's name is typed in one text box to the person who's name is typed in another text box. For some reason, it isn't working. Local script in StarterGUI
local Event = game.ReplicatedStorage.Folder:WaitForChild("AT")
script.Parent.MouseButton1Click:Connect(function() --When button pressed
local player = script.Parent.Parent.Player.Text --Player being teleported to
local target = script.Parent.Parent.Target.Text --Player whos being teleported
if game.Players:FindFirstChild(player) and game.Players:FindFirstChild(target) then
Event:FireServer(player,target)
end
wait(1)
script.Parent.Parent.Target.Visible = true
script.Parent.Parent.Target.Text = "Person who's being teleported"
end)
Server script in workspace
local Admins = {"DominousSyndicate"}
function CheckIfAdmin(player)
local result = false
for i, v in pairs(Admins) do
if player.Name == v then
result = true
end
end
return result
end
game.ReplicatedStorage.Folder.AD.OnServerEvent:Connect(function(player,player1,target)
if game.Players:FindFirstChild(player1) then
local isAdmin = CheckIfAdmin(player)
if isAdmin then
local targetplayer = game.Players:FindFirstChild(player1)
local target = game.Players:FindFirstChild(target)
target.Character.Humanoid.Jump = true
target.Character:MoveTo(player.Character.HumanoidRootPart.CFrame)
end
end
end)

1 comment
It looks like your 'Admins' thing is in a comment