Could you test it out if you don’t mind?
They said that the textLabel wasnt changing its text even though the script was a child of the text label and they put
script.Parent.Text = "ABC"
on the first line
Neither did it change the text to ABC, and also didn’t print anything, however in the script with the print function got me an error:
It’d be appreciated if you are to show us the entirety of the script you have run on that.
You didnt change this to Humanoid.Changed
It’s basically just a short script parented to the TextLabel that is used to change the text
dont mind the line 1
Also doesn’t update anything. I don’t even get any errors in the output so I can’t tell you what it really about
If it did work that would have broke it because Health is a property which is nto an instance so there is not an event called “Changed” connected to it. After clicking Play could you then send a screenshot of the class tree. Is the TextLabel still there?
The Changed
event should be connected directly to the instance, not the property value; Hence the property name should be sent to the event as the first parameter:
humanoid = script.Parent.Parent.Parent.Parent.Parent.Parent.Humanoid
humanoid.Changed:Connect(function(Property)
if Property == "Health" then
script.Parent.Text = humanoid.Health.."/"..humanoid.MaxHealth
end
end)
it’s still there
This one works perfectly! That you so much all for the help!
humanoid.Changed:Connect(function()
print(humanoid.Health)
script.Parent.Text = humanoid.Health.."/"..humanoid.MaxHealth
end)
do you have the print in the script still??
I’m happy that it has worked out, I hope you’ve understood how the Changed
event works as of now!
Thank you all. Hope you have a great rest of your day.
Check this maybe it will make your code more cooler.
https://developer.roblox.com/en-us/api-reference/function/Instance/GetPropertyChangedSignal