Setting humanoid's WalkSpeed to zero and anchoring the HumanoidRootPart doesn't change anything. First I set the WalkSpeed to zero then I create the parts so it's not a ordering problem. Later I tried using "if not humanoid.Running then" to make the function useable when the character's not walking, but it also doesn't help. See the GIF below for visual reference if needed, thanks in advance.
I forgot to mention that I tried using,"repeat RunService.Heartbeat:Wait() until humanoid.WalkSpeed == 0," it was another failed attempt... Using a long wait(1) fixes the problem but that's clearly a bad solution, any ideas?
Click here to view the script.
Please help me, I won't be able to finish the script without fixing this.
Thanks to gullet from the Scripting Helpers Discord, I could find a solution to this part spawning behind moving player problem. First, unanchor the parts then create Motor6Ds attached to the HumanoidRootPart and both parts. Second, set the same CFrames as before but use Motor6D.C0 instead of part.CFrame. Done, the script's fixed! It has something to do with using relative positions instead of world positions, I thought I had to continuously change the CFrame through the script but that was another failed attempt. All I had to do was weld the parts together! Thanks again, gullet.