yes, i dont know how to do this.
basically, i need to know how i can run a script "every time" my localplayers health 20.
so something like this, but i need it to do this every time when i re spawn or reset.
local humanoid = game:GetService("Players").LocalPlayer:GetCharacter().Humanoid
if humanoid.Health >= 5 then
FunctionName()
end
LocalScript:
local hum = game.Players.LocalPlayer.Character:WaitForChild("Humanoid") hum.Changed:Connect(function() if hum.Health >= 20 then --Do something end end
Not sure if this is what you're looking for but here you go
tell me if you have a problem
To check if a condition has changed, you would need to use the loop, while true do. Basically what this does is run the script over and over until the specific condition changes. When it changes you can either break the script with the 'Break' or let it continue.
local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid")
while true do wait() if humanoid.Health >= 5 then end