Part appearing when IntValue is greater than a certain number not working

That title was quite a tongue twister.

Anyways, I have inserted a script into a part and typed a very simple code. Basically, I want the part (which has its transparency set to 1) to appear (transparency = 0) when an IntValue (named CurrencyToCollect) is greater than 10.

Here is the code:

if script.Parent.Parent.Parent.Parent.CurrencyToCollect.Value > 10 then
script.Parent.Transparency = 0
end

The script is not working and there are no errors. If anyone could help, that would be great.

Thanks,
kitekite

Cool thing: We have something called the Changed event which is capable of firing whenever Values change & get detected :thinking:

Try this:

local Currency = script.Parent.Parent.Parent.Parent.CurrencyToCollect

Currency.Changed:Connect(function(NewValue)
    if NewValue > 10 then
        script.Parent.Transparency = 0
    end
end)
1 Like

Ah, this works perfectly! Thanks for the help!