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

How can I make this frame transparence?

Asked by 8 years ago
gui = script.Parent
frame = gui.Frame
timeadd = 0.1
timeup = 1
player = game.Players.LocalPlayer
x = frame.BackgroundTransparency 

function loadup()
     if frame then
        while true do
            if x ~= timeup then
                wait(0.5)
                x = x+timeadd
            elseif x == timeup then
                break
            end 
        end
    end
end

player:WaitForDataReady(loadup)

1 answer

Log in to vote
0
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
8 years ago

When you say

x = frame.BackgroundTransparency

You are saying

Set the variable x to the evaluation of frame.BackgroundTransparency. (I'm going to look up what that value is -- probably 0, and save that)

It does not "tie" the value of x to frame.BackgroundTransparency.

Later when you set x, you just set x -- you didn't ask it to change the BackgroundTransparency of frame, so it doesn't.

When you get x later, the same goes -- you're getting x, not the background transparency.

You have to be explicit.


It's worth saying that you should use a for loop instead of a while true do loop here:

for t = 0, timeup, timeadd do
    wait(0.5)
    frame.BackgroundTransparency = t
end
0
thxs BuilderCosmic 43 — 8y
Ad

Answer this question