Xanthys
(Xanthys)
December 29, 2022, 3:57pm
#1
This loop:
while wait() do
local alt = 0.28 * hrp.Position.Y - workspace.Baseplate.Position.Y
altmeter.Altitude.Text = math.floor(alt).." M"
end
Works perfectly fine, but when you die and respawn, it doesn’t work. How do I make it so that it continues even when you respawn?
rtvr56565
(rtvr56565)
December 29, 2022, 3:58pm
#2
Where is the script? show a print of your explorer
Xanthys
(Xanthys)
December 29, 2022, 4:00pm
#3
It is in a LocalScript, does that have something to do with it?
rtvr56565
(rtvr56565)
December 29, 2022, 4:07pm
#4
I mean, where the script is in the explorer, if it’s on Character Scripts, Player Gui or another place
1 Like
Is it erroring? It might be because, if it’s in starterplayer scripts, the humanoidrootpart is unable to found while the player is dead, so it can’t get the altitude?
Xanthys
(Xanthys)
December 29, 2022, 4:11pm
#6
It doesn’t error, but still stops when dying. I have it in StarterPlayerScripts so that could be the problem.
Floo_d
(Floo_d)
December 29, 2022, 4:19pm
#7
If you’re relying on that script being in “StarterPlayerScripts”, make sure you’re updating the “hrp” variable whenever a new character is added.
Like this:
Player.CharacterAdded:Connect(function(newCharacter)
hrp = newCharacter:WaitForChild("HumanoidRootPart",10)
end)
Xanthys
(Xanthys)
December 29, 2022, 4:27pm
#8
After resetting and respawning, it now gives an error relating to the TextLabel that it uses.
Xanthys
(Xanthys)
December 29, 2022, 4:31pm
#10
So that’s what that does? I never knew, thanks!
1 Like
system
(system)
Closed
January 12, 2023, 4:32pm
#11
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.