"Changed" Built in function not working

I am having issues with the “Changed” function firing. whenever the value of the integer value changes, the built-in function does not work. Is there a fix for this? here is the code:

local TEXT = script.Parent.BillboardGui.TextLabel.Text
local HealthValue = script.Parent.HealthValue.Value
script.Parent.HealthValue.Changed:Connect(function()
	print("fired")
	TEXT = HealthValue.."/50"
	if HealthValue >= 0 then
		script.Parent.Transparency = 1
		script.Parent.CanTouch = false
		wait(30)
		script.Parent.Transparency = 0 
		script.Parent.CanTouch = true
	end
end)

in the workspace, when I change the value of the intvalue, this function doesn’t work.

Change the HealthValue to

local HealthValue = script.Parent.HealthValue

since Changed is only for instances and not properties.

1 Like

after changing the code to this, it still doesn’t work.

local TEXT = script.Parent.BillboardGui.TextLabel.Text
local HealthValue = script.Parent.HealthValue

script.Parent.HealthValue.Changed:Connect(function()
	print("fired")
	TEXT = HealthValue.Value.."/50"
	if HealthValue.Value >= 0 then
		script.Parent.Transparency = 1
		script.Parent.CanTouch = false
		wait(30)
		script.Parent.Transparency = 0 
		script.Parent.CanTouch = true
	end
end)

Nevermind, I was dumb and was changing the health with a script that was firing client sided. Thanks for the help!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.