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.

3 comments
Try capitalizing the c in Character, that's what causes most problems in scripting.
Mendoza is right. However I recommend putting the .Chatted function in StarterPlayerScripts and use RemoteEvent to fire in the server.
And also try to split the message by using string.match()