i can try but im pretty sure character is loaded at that time. players cant die during game and it had been minutes since the character joined the game and characteradded fired
Try this, i have a similar script that works fine. Plus, it never hurts to add extra checks incase the player isn’t fully loaded.
for i, player__ in ipairs(ps:GetPlayers()) do -- because ipairs() is used for arrays.
if player__.Character then
player__.Character:PivotTo(spleef_map:WaitForChild("SpleefFirstTP").CFrame + Vector3.new(0, 2, 0) -- This will ensure that the player doesn't teleport glitched into the tp part.
end
end
end
Firstly, if this is being done on the server, you shouldn’t have to do WaitForChild for the spleef map anymore. Secondly, if PivotTo still doesn’t work, it might be better to try going old-school and just teleporting the HumanoidRootPart of the player’s character instead. You could also use MoveTo as an alternative but that takes a Vector3 Position instead of a CFrame.
It’s also always better and faster to just make a direct reference to the map via a variable instead of making a new reference to it every single time.
local teleportPoint = spleef_map:FindFirstChild("SpleefFirstTP")
if not teleportPoint then
warn("Teleport point not found.")
return
end
for _, player in ps:GetPlayers() do
local character = player.Character
if not character then
continue
end
local root = character:FindFirstChild("HumanoidRootPart")
if not root then
warn("Root not found") -- mainly adding warnings for debugging
continue
end
root.CFrame = teleportPoint.CFrame
end