function teleportPlayers(player)
for i, player in ipairs(Players:GetPlayers()) do
if player then
local character = player:FindFirstChild('Character')
print('found character')
local root = character:FindFirstChild("HumanoidRootPart")
print('found root part')
root.Position = selectedMap.Position
print('moved hrp')
end
end
end
The print statement ‘found character’ runs fine, but nothing after that works. This appears in the output:
try doing
if player.Character and player.Character.HumanoidRootPart then
–tp
end
and dont use :FindFirstChild as it finds a child and character is a property
Character and Player can be with the same name and belong to the same guy, however, neither of them is the child / parent of the other. Each of them has different stuff that you can apply on.
2)You can do something like this:
local character = game.Workspace:FindFirstChild(player.Name)