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

Why isn't my PlayerGui transparency animation script working?

Asked by
alibix123 175
8 years ago

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?

0
Use WaitForChild User#11440 120 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago

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 LocalScriptscan be used, such as StarterGui

0
How come StarterPlayerScripts doesn't work but StarterCharacterScripts does for me? alibix123 175 — 8y
Ad

Answer this question