PivotTo not working (or I missed somthing)

plr.CharacterAppearanceLoaded:Connect(function(char)
local SpawnPoint = game:GetService("Workspace"):FindFirstChild("Spawn"):FindFirstChild("SpawnPoint").Value


		local spawnlocation = SpawnPoint:GetPivot()


		char:PivotTo(spawnlocation)
end

its just the pivotto not doing anything

what exactly is the object you’re trying to pivotto? i can’t tell what’s happening without further explanation

I assume the spawnPoint.Value is a model and that the GetPivot() returns something compatible with PivotTo?

If it is then...

When characters load there are a bunch of Roblox scripts running in the background which haven’t necessarily completed before your code runs. So it looks like it hasn’t worked but was actually just overwritten by the default scripts.

You could add a task wait to allow time for the default scripts to complete before yours does, but it sets up a race condition in the case it is taking longer for some reason.
Perhaps more reliably, set a spawn location where you actually want them to spawn (these can be set specifically) or, expect the character to load at the default location and then handle it with a physics event.

You can get the position of the spawn point then do CFrame.new(Position) in the :PivotTo method.

plr.CharacterAppearanceLoaded:Connect(function(char)
local SpawnPoint = game:GetService("Workspace"):FindFirstChild("Spawn"):FindFirstChild("SpawnPoint").Value
		local spawnlocation = SpawnPoint.Position

		char:PivotTo(CFrame.new(spawnlocation))
end

Thanks for The Reply , but I tried that originally . My character just refuses to pivot to the given location.

Try plr.CharacterAdded or add a wait and see if that fixes it.

The thing is, you can’t set the player’s position until their HumanoidRootPart has loaded and you call task.wait

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.