game:GetService("Players").PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
while true do
wait(0.5)
local torso = character:WaitForChild("Torso")
player.leaderstats.Height.Value = math.ceil(torso.CFrame.y)/8
end
end)
end)
thats the script, it keeps going to the value it did before i died
Because the loop doesnt stop when you respawn. Its also a memory leak.
Here:
game:GetService("Players").PlayerAdded:Connect(function(player)
local updateValue
player.CharacterAdded:Connect(function(character)
if updateValue then task.cancel(updateValue) end
updateValue = task.spawn(function()
while true do
task.wait(0.5)
local torso = character:WaitForChild("Torso")
player.leaderstats.Height.Value = math.ceil(torso.CFrame.y)/8
end
end)
end)
end)