Hi, i made a script that's located in ServerScriptService. When a player says /jail username, it is meant to teleport them to a certain place on the map, however it isn't working.
game.Players.PlayerAdded:Connect(function(player) player.Chatted:Connect(function(msg) for i,player2 in pairs(game.Players:GetPlayers()) do if msg == "/jail "..player2.Name then player2.character.Torso.CFrame.new(34.5, 0.5, -66.7) end end end) end)
Any help is hugely appreciated, thanks.
You are not setting the CFrame of the torso properly.
I recommend changing line 5 to:
player2.Character.HumanoidRootPart.CFrame=CFrame.new(34.5, 0.5, -66.7)