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

How to i can change image transparency on load game?

Asked by 4 years ago

Guys, i'm trying make load screen, i created a image, with: ImageTransparency 1 and Background Transparency 1,my script does not work, even though it is I believe I totally correct, I know that this script is a very easy thing, more for some reason does not work, I've tried everything, so that's the script:

local Exemple = game.StarterGui.Intro.Exemple wait(1) print("Background Loaded.") --Background Transparency wait(0.1) script.Parent.Exemple.ImageTransparency = 1 script.Parent.Exemple.BackgroundTransparency = 1 wait(0.1) script.Parent.Exemple.ImageTransparency = 0.9 script.Parent.Exemple.BackgroundTransparency = 0.9 wait(0.1) script.Parent.Exemple.ImageTransparency = 0.8 script.Parent.Exemple.BackgroundTransparency = 0.8 wait(0.1) script.Parent.Exemple.ImageTransparency = 0.7 script.Parent.Exemple.BackgroundTransparency = 0.7 wait(0.1) script.Parent.Exemple.ImageTransparency = 0.6 script.Parent.Exemple.BackgroundTransparency = 0.6 wait(0.1) script.Parent.Exemple.ImageTransparency = 0.5 script.Parent.Exemple.BackgroundTransparency = 0.5 wait(0.1) script.Parent.Exemple.ImageTransparency = 0.4 script.Parent.Exemple.BackgroundTransparency = 0.4 wait(0.1) script.Parent.Exemple.ImageTransparency = 0.3 script.Parent.Exemple.BackgroundTransparency = 0.3 wait(0.1) script.Parent.Exemple.ImageTransparency = 0.2 script.Parent.Exemple.BackgroundTransparency = 0.2 wait(0.1) script.Parent.Exemple.ImageTransparency = 0.1 script.Parent.Exemple.BackgroundTransparency = 0.1 wait(0.1) script.Parent.Exemple.ImageTransparency = 0 script.Parent.Exemple.BackgroundTransparency = 0

1 answer

Log in to vote
0
Answered by 4 years ago

First of all USE CODE BLOCK. It's location with the lua icon and it looks like this ~~.Here's a good tip for optimisation: for loops. For loops repeat for how many times you want it to. I'll show you how it works:

Make sure it's a local script parented under your ScreenGui.

local gui = script.Parent.Exemple --Use this instead of StarterGui. StarterGui only works when you reset. Alternatively, you can use game.Players.LocalPlayer:WaitForChild("PlayerGui").Intro.Exemple
wait(1) --don't know why you need this
print("background loaded")
for i = 1, 0, 0.1 do --The 1st part is the start. I set it to one. The 2nd is the end, and the 3rd is the increment. It's gonna go down by 0.1.
    script.Parent.Exemple.ImageTransparency = i
    script.Parent.Exemple.BackgroundTransparency = i
    wait(0.1)
end
Ad

Answer this question