Try adding a WaitForChild() as the script is local and is probably loading before the humanoidrootpart has loaded. So it would be game.Players.LocalPlayer.Character:WaitForChild(“HumanoidRootPart”).Position
Can you try adding the 2 lines of code I provided into both sections of your scripts? (line six and line nineteen) I think this might solve your problem.
If that did not work, you can also try @unwronged’s method of adding a WaitForChild.
This is actually great debugging info. Now you know the script cannot find the Character/HumanoidRootPart. If you manually join your game, can you check yourself if there is any HumanoidRootPart in your character at all? Cause that might be the culprit here.
(Also, don’t forget to change the while true do on line 20 to while wait() do, this prevents a repeating loop that could crash your game.)