local function PlayerAdded(player)
if player.Character then
print("character already there")
local position = CFrame.new(-24.741, 8.897, 34.543)
local orientation = CFrame.Angles(0,math.rad(90),0)
player.Character:WaitForChild("HumanoidRootPart")
player.Character:SetPrimaryPartCFrame(position*orientation)
player.Character:PivotTo(position*orientation)
print(player.Character:GetPivot())
DisablePlayerCollision(player.Character)
player.Character.DescendantAdded:Connect(DisablePlayerCollision)
end
player.CharacterAdded:Connect(function(character)
print("character added")
local position = CFrame.new(-24.741, 8.897, 34.543)
local orientation = CFrame.Angles(0,math.rad(90),0)
player.Character:WaitForChild("HumanoidRootPart")
player.Character:SetPrimaryPartCFrame(position*orientation)
player.Character:PivotTo(position*orientation)
print(player.Character:GetPivot())
DisablePlayerCollision(player.Character)
player.Character.DescendantAdded:Connect(DisablePlayerCollision)
end)
As you can, see, the code segments do the exact same thing, but, when the character added function runs, it consistently puts the player in the wrong orientation, while the âcharacter thereâ one does it correctly. How can I fix this?
This could permenantly yield the functionâs execution (in the event that when âCharacterAddedâ is fired the character has already been parented to the âWorkspaceâ container). While an annoying fix the task.wait() should suffice.
I have thought about this but everytime I do this, I have never seen this infinitely yeilding. Thus, I believe it is extremely rare to happen.
Assuming Player:LoadCharacter() has the same events with CharacterAutoLoads, Player.CharacterAdded fires before parenting, well parenting to DataModel? (not sure why it parents to DataModel)