Hello! I wanted to know how to fix this. Looks normal if you say so. However, what I've encountered was when I fall into the void, it sends that error, breaking the script and no longer able to run. How do I fix this? Thanks. Also, it is run on a loop so don't know how to reset it and make it work again then to leave and rejoin.
local distance = (player.Character.HumanoidRootPart.Position - Floaty.PrimaryPart.Position).Magnitude
When a character dies this error will appear if you try to access any part of the character model. To get around this you just have to get used to doing checks. For instance, before you do what you are currently doing, add this:
local hrp = player.Character:FindFirstChild("HumanoidRootPart") if hrp and player.Character.Humanoid.Health > 0 then local distance = (hrp.Position - Floaty.PrimaryPart.Position).Magnitude end
Simple enough, just make sure the script is only running if you can find everything you need to run it. Let me know if this still doesn't work.