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 ^^
Okay, so you'll need to loop through the players and get their characters.
while true do for i, player in pairs(game.Players:GetPlayers()) do -- Loops through the players local char = player.Character -- Character variable if char:FindFirstChild("HumanoidRootPart") then -- Check for HRP -- HumanoidRootPart found else -- HumanoidRootPart not found end end wait() end
Insert the code you want in the HumanoidRootPart not found part.