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

TextButtons won't go transparent with script?

Asked by
Stravan 18
7 years ago

Scripting novice here. Trying to make the screen go white with the color correction effect in lighting (since it looks nicer than a white frame turning opaque). Since this effect doesn't cover up the GUI, I wanted all the text on the screen to simply fade out when the button is clicked. This doesn't happen though, and only the screen goes white while the rest stays the same. Any idea how to fix it?

01s = game:GetService("TeleportService")
02id = 186379525
03 
04local cc = game.Lighting.ColorCorrection
05local logo = game.StarterGui.logo.ImageLabel
06local tut = game.StarterGui.tutorial.TUTORIAL
07local change = game.StarterGui.changelog.Play
08local cred = game.StarterGui.credits.Play
09local play = game.StarterGui.play.Play
10 
11function onClicked()
12 
13    for i = 0.02,1.5,0.05 do
14        cc.Brightness = i
15        cred.TextTransparency = i
View all 26 lines...

1 answer

Log in to vote
0
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
7 years ago
Edited 7 years ago

You should read this article to understand where UI is located in the game. You should be editing the LocalPlayer's PlayerGui, rather than the StarterGui.

This should be a LocalScript.

01--WaitForChilds because things take time to load on the client
02local s = game:GetService("TeleportService")
03local id = 186379525
04local cc = game.Lighting.ColorCorrection
05local plr = game.Players.LocalPlayer --Define the Player
06local ui = plr:WaitForChild("PlayerGui") --Search through PlayerGui
07local logo = ui:WaitForChild("logo"):WaitForChild("ImageLabel")
08local tut = ui:WaitForChild("tutorial"):WaitForChild("TUTORIAL")
09local change = u:WaitForChild("changelog"):WaitForChild("Play")
10local cred = ui:WaitForChild("credits"):WaitForChild("Play")
11local play = ui:WaitForChild("play"):WaitForChild("Play")
12local t = "TextTransparency" --Variable to keep the code concise.
13 
14function onClicked()
15    for i = 0.02,1.5,0.05 do
View all 24 lines...
Ad

Answer this question