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

I've tried to use "if" to detect another image but it doesn't work. How do you do it correctly?

if game.StarterGui.LoadingGui.LoadingImage.Visible = false  then <-- this line here
	script.Parent.TextTransparency = 0.1
	wait(0.5)
	script.Parent.TextTransparency = 0.2
	wait(0.5)
	script.Parent.TextTransparency = 0.3
	wait(0.5)
	script.Parent.TextTransparency = 0.4
	wait(0.5)
	script.Parent.TextTransparency = 0.5
	wait(0.5)
	script.Parent.TextTransparency = 0.6
	wait(0.5)
	script.Parent.TextTransparency = 0.7
	wait(0.5)
	script.Parent.TextTransparency = 0.8
	wait(0.5)
	script.Parent.TextTransparency = 0.9
	wait(0.5)
	script.Parent.TextTransparency = 1
end

2 comments

0

Use playergui when trying to get a gui as the playergui is a cointainer that holds the gui's. Also use a numerical for loop for efficiency

0

Check if it was true using a changed event, This only does it for if it was set to false when the game started.

2 answers

✓ Accepted answer

A key pointer here would be to remember that when checking for equality you need to use the double equals symbol.

if game.StarterGui.LoadingGui.LoadingImage.Visible == false then

However, as the comments have suggested it'd probably be better to use a changed event so that you can check immediately after something changes and not just once.

1 comment

0

Why are you not referencing the player's gui? [Therefore your answer is incorrect]

Always remember: A double equal sign (==) is for equality. A single equal (=) sign is for changing some property, like the parent of a part.

Your edit script accounting for these changes:

if game.StarterGui.LoadingGui.LoadingImage.Visible == false  then --Changed this from "=" to "==" to check for equality, not to change something.
    script.Parent.TextTransparency = 0.1
    wait(0.5)
    script.Parent.TextTransparency = 0.2
    wait(0.5)
    script.Parent.TextTransparency = 0.3
    wait(0.5)
    script.Parent.TextTransparency = 0.4
    wait(0.5)
    script.Parent.TextTransparency = 0.5
    wait(0.5)
    script.Parent.TextTransparency = 0.6
    wait(0.5)
    script.Parent.TextTransparency = 0.7
    wait(0.5)
    script.Parent.TextTransparency = 0.8
    wait(0.5)
    script.Parent.TextTransparency = 0.9
    wait(0.5)
    script.Parent.TextTransparency = 1
end

1 comment

0

Why are you not referencing the player's gui? [Therefore your answer is incorrect]

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