Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Scrolling frame's visibility not changing to false?

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

1 comment

0

Im edited the answer, check it now :)

3 answers

✓ Accepted answer

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

1 comment

0

Works, thank you so much!

Edit:

script.Parent.Text.Changed:Connect(function()
if script.Parent.Text == "Total score: +5" then
    script.Parent.Parent.Visible = false
end
end)

3 comments

0

I was rushed and I am quite new.

0

.

1

also, when the code is something simple as this, there isnt really in need of an explanation

script.Parent.Changed:Connect(function()
	if script.Parent.Text == "Total score: +5" then
		script.Parent.Parent.Visible = false
	end
end)

2 comments

0

Whenever someone clicks a text button, the text label does change but this script won't work. I want this script to wait and check if the text is changed but it only works when the text is already set when the game starts!

0

thats not how it works

This discussion is preserved as it was. New answers, comments, and votes are closed.