I am making a Local Script that calls a function when your health gets below 25. The script works fine in F6 studio test mode, but online it simply refuses to work. The code is:
char.Humanoid.Changed:connect(function(prop)
local hum = char:WaitForChild("Humanoid")
if prop == "Health" then
print("prop gotten")
if prop <= 25 then
regenerate()
end
end
end)
char is defined as:
local lp = game.Players.LocalPlayer
local char = lp.Character
if not char or not char.Parent then
char = lp.CharacterAdded:wait()
end
It is definitely the if prop <= 25 then line that is the problem, as prints have told me. Why would this line work in studio, but not online?
Please help.

1 comment
My game is unfortunately not FE, but simply changing the Changed event to HealthChanged seems to have fixed it. Thanks!