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

How can I make this frame transparence?

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

✓ Accepted answer

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

1 comment

0

thxs

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