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

Why isn't my PlayerGui transparency animation script working?

I just want the frame to fade from opaque to transparent. I've tried 3 different variations:

playerGui = game.Players.LocalPlayer.PlayerGui

for i=1,10 do
	wait(1)
	playerGui.ScreenGui.Frame.BackgroundTransparency = playerGui.ScreenGui.Frame.BackgroundTransparency + .1
end

playerGui = game.Players.LocalPlayer.PlayerGui

for i=0, 1,0.1 do
	playerGui.ScreenGui.Frame.BackgroundTransparency = i
end

playerGui = game.Players.LocalPlayer.PlayerGui

for i=0, 1,0.1 do
	playerGui.ScreenGui.Frame.BackgroundTransparency = i + playerGui.ScreenGui.Frame.BackgroundTransparency
end

When I test the game, nothing happens! Where am I going wrong?

1 comment

0

Use WaitForChild

1 answer

✓ Accepted answer

The second script works perfectly. While this is true, I've made a few adjustments of my own so that the payer will be able to actually see the GUI fade.

timeWait = 1 --Change to whatever you'd like it to be
playerGui = game.Players.LocalPlayer.PlayerGui

for i=0, 1,0.1 do
    wait(timeWait)
    playerGui:WaitForChild'ScreenGui'.Frame.BackgroundTransparency = i
end

Note: make sure this is in a LocalScript, and that it is in a child where LocalScripts can be used, such as StarterGui

1 comment

0

How come StarterPlayerScripts doesn't work but StarterCharacterScripts does for me?

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