Hello everyone
I recently bought a story game kit from the library, but the teleport function, which needs to teleport players to a specific part in Workspace, isn’t working. Am I doing something wrong, or is the script not correct?
The function:
function teleportPlayers(partCFrame)
local players = game.Players:getPlayers()
for _,player in pairs(players) do
if player.Character then
if player.Character.HumanoidRootPart.Anchored == false then
player.Character.Humanoid.Jump = true
end
end
end
wait(.5)
for _,player in pairs(players) do
if player.Character then
if player.Character.HumanoidRootPart.Anchored == false then
player.Character:SetPrimaryPartCFrame(partCFrame)
end
end
end
end
When the script needs to teleport players:
teleportPlayers(game.Workspace.TeleportPart.Position)