I’m trying to make a teleport command and it goes like this…
Player types; “!tp Player1 Player2”, Player1 will be teleported to Player2.
I tested it with a friend and it doesn’t work. Send help, thanks much!
local command = "!tp"
game.Players.PlayerAdded:Connect(function(plr)
local char = plr.Character or plr.CharacterAdded:Wait()
plr.Chatted:Connect(function(msg)
local splitmsg = string.split(msg, " ")
if splitmsg[1] == command then
local hrp1 = workspace:FindFirstChild(splitmsg[2]):WaitForChild("HumanoidRootPart")
local hrp2 = workspace:FindFirstChild(splitmsg[3]):WaitForChild("HumanoidRootPart")
hrp1.Position = hrp2.Position
end
end)
end)