Players.PlayerAdded:Connect(function(player)
local char = player.Character or player.CharacterAdded:Wait()
local cl = ServerStorage.Part:Clone()
local weld = Instance.new("WeldConstraint")
task.wait(5) --only to allow some time to see the change in orientation
weld.Part0 = char:WaitForChild("HumanoidRootPart")
print(weld.Part0)
weld.Part1 = cl; weld.Parent = cl
cl.Parent = workspace
end)
Here is what happens to the player:
As you can see, for the first few seconds the character faces its moving direction. However when the part is welded to the character it keeps the direction it faced the last time before the weld.
Is this normal?
(Sidenote: I played a few games with this rotation-issue, but never noticed something to be welded to the character)
Do you know what is happening or what I am doing wrong?
to change the RootPart. This didnt solve the issue.
Setting the cl.Parent to workspace.CurrentCamera also didnt help.
With the RigidConstraint I am not sure (partially because I never used it). Maybe I should explain what I am trying to achieve.
I want to have an area around a certain player which does something to any player who comes inside this area. This itself would be simple. I could just check the distance between the player with the area to all other players in a loop. But I also want it to be visible to the other players, thus I need a part on the player.
I should have started with explaining my goal, sorry
Eventhough this solves the orientation issue, it just makes the part swirl around the player.
I checked the reference on the AlignPosition. If I understand correctly, this involves physics. Maybe thats the problem.
But thank you
This could work. Currently, on spawn, the player flips to the side but gets up after a few seconds. I played around with the parts shape - doesnt help.
But I will experiment with this tomorrow and see if I can make it work.
I am admittedly a little surprised that this works (to some degree). According to the reference the main difference between a WeldConstraint and a RigidConstraint is that RigidConstraint uses two Attachments instead of one to make it easier to attach accessories to the player.
I recommend adding another part to the model and set it to the size of a HumanoidRootPart. Rotate this however you want and try to weld that to the player instead. I am not too sure but I believe this could work.
I am still wondering why this seemingly common and simple problem (having a part fixed to the player) is so poorly documented. But maybe I have been just searching for it the wrong way or have accidentally skipped a certain part of basic knowledge. Mybe it is so obvious and I was just blind ^^.