I would post this under Bug reports but I don’t have access to it.
This is the function I have:
function SpawnService:OnPlayerDeath(player, character)
local playerTeam = ClassesAndTeamService:GetPlayerTeam(player)
if playerTeam == "Humans" then
local random = Random.new()
local spawn = self._humanSpawns[random:NextInteger(1, #self._humanSpawns)]
Teleport(character.Humanoid, {
freeze = false,
faceAngle = 0,
destination = Vector3.new(spawn.Position)
})
print("Where player is: ", tostring(character:GetPrimaryPartCFrame().Position))
print("Where spawn is (and player should be): ", tostring(spawn.Position))
else
local random = Random.new()
local spawn = self._zombieSpawns[random:NextInteger(1, #self._zombieSpawns)]
Teleport(character.Humanoid, {
freeze = false,
faceAngle = 0,
destination = Vector3.new(spawn.Position)
})
print("Where player is: ", tostring(character:GetPrimaryPartCFrame().Position))
print("Where spawn is (and player should be): ", tostring(spawn.Position))
end
end
Teleport is copy-pasted from the wiki article.
Note the two print statements I have on the if-else chain. When I run this code, this is what I get in the output:
Despite using the teleport from the wiki, the player never spawns at the right point, not even close. What’s even weirder is running through the debugger, the code does work and tp’s the player to the correct point, but in normal time, not using the debugger, it doesn’t work.