There is my script :
repeat wait() until player.Character
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local Height = Instance.new("IntValue")
Height.Name = "Height"
Height.Parent = leaderstats
while true do wait()
local HumanoidRootPart = player.Character:FindFirstChild("HumanoidRootPart")
repeat wait() until HumanoidRootPart
Height.Value = (player.Character.HumanoidRootPart.Position.Y - 8)
end
end
My problem is when a player fall in the void, the HumanoidRootPart is deleted and it create an error, I wanted the script to constantly check if HumanoidRootPart is existing but i don't know how!
The script is in ServerScriptService and it's a normal one.
Thank you in advance ^^

5 comments
It is way easier to do repeat (...) until HumanoidRootPart == nil. Just saying.
Thank you for your answer but I didn't understand what i need to do :S do i need to paste this into my script before everything else or just in my while true loop?
But @MCAndRobloxUnited when doing this it will only continue the script if the HumanoidRootPart is nil isn't it? I want exactly the opposite
You can stick everything that your script does in that repeat loop.
Ok I'm just dumb xD Thank you very much @despicablejack2005 I needed 42minutes to figure out what to do haha forgive my bad scripting level!