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

My ScreenGUI images don't work when I press a button. Help please?!

Asked by 7 years ago

I have made a game and there are buttons when you press it there's a sound and there's a countdown as well. If I press the button in testing mode nothing happens only the sound plays. Here's the code:

function onClicked()
    wait(0.5)
    game.StarterGui.CountDownNo.Three.ImageTransparency = 0 -- Number Three Appears
    script.Parent.Sound:Play()
    wait(1)
    game.StarterGui.CountDownNo.Three.ImageTransparency = 1 -- Number Three Disappears
    game.StarterGui.CountDownNo.Two.ImageTransparency = 0 -- Number Two Appears
    wait(1)
    game.StarterGui.CountDownNo.Two.ImageTransparency = 1 -- Number Two Dissapears
    game.StarterGui.CountDownNo.One.ImageTransparency = 0 -- Number One Appear
    wait(1)
    game.StarterGui.CountDownNo.One.ImageTransparency = 1 -- Number One Disappears
end

script.Parent.ClickDetector.MouseClick:connect(onClicked)

Please help! I'm new to scripting.

1 answer

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago

I changed

    game.StarterGui.CountDownNo.Three.ImageTransparency = 0 -- Number Three Appears

to

    game.Player.LocalPlayer.PlayerGui.CountDownNo.Three.ImageTransparency = 0 -- Number Three Appears

I modified StarterGui, Which is what gets copied over to a player's PlayerGui so nothing was updated.

Ad

Answer this question