Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

Scrolling frame's visibility not changing to false?

Asked by 4 years ago
Edited 4 years ago

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

0
Im edited the answer, check it now :) Block_manvn 395 — 4y

3 answers

Log in to vote
2
Answered by 4 years ago
Edited 4 years ago

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

0
Works, thank you so much! SilentsReplacement 468 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Edit:

script.Parent.Text.Changed:Connect(function()
if script.Parent.Text == "Total score: +5" then
    script.Parent.Parent.Visible = false
end
end)
0
I was rushed and I am quite new. PrismaticFruits 842 — 4y
0
. PrismaticFruits 842 — 4y
1
also, when the code is something simple as this, there isnt really in need of an explanation Gameplayer365247v2 1055 — 4y
Log in to vote
0
Answered by 4 years ago
script.Parent.Changed:Connect(function()
    if script.Parent.Text == "Total score: +5" then
        script.Parent.Parent.Visible = false
    end
end)
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! SilentsReplacement 468 — 4y
0
thats not how it works Gameplayer365247v2 1055 — 4y

Answer this question