Hey there, I've been making my game Book of coding in ROBLOX. I've made that if you choose the correct options, the text label will change. That works fine but when the text label changes to a certain text like Total score: +5
, the frame's visible
property won't get unchecked.
I want it so that if the text label changes to a certain text, the frame will disappear.
Here's the local script inside the text label:
if script.Parent.Text == "Total score: +5" then script.Parent.Parent.Visible = false -- Changes the frame visibility to false.. end
I think it better to use function Instance:GetPropertyChangedSignal(). It is a function that listen to the changing of a specific property of an instance.
script.Parent:GetPropertyChangedSignal("Text"):Connect(function() --This will listen to the property Text of the UI if script.Parent.Text == "Total score: +5" then --Checking is the text is "Total score: +5" or not script.Parent.Parent.Visiable = false --Make the UI in-visiable end end)
Hope this helping you :D
Edit:
script.Parent.Text.Changed:Connect(function() if script.Parent.Text == "Total score: +5" then script.Parent.Parent.Visible = false end end)
script.Parent.Changed:Connect(function() if script.Parent.Text == "Total score: +5" then script.Parent.Parent.Visible = false end end)