I copied this from a working script I made here, and edited it:
This one is supposed to pop up an information box when you click on another GUI, and it works perfectly:
infobase = script.Parent.Parent.InformationBase infobase2 = script.Parent.Parent.InformationBase.InformationTitle infobase3 = infobase2.TextLabel local droppeddown = false function infor() if droppeddown == false then script.Parent.Text = "Close Information" infobase.Visible = true infobase2.Visible = true infobase3.Visible = true droppeddown = true elseif droppeddown == true then script.Parent.Text = "Information" infobase.Visible = false infobase2.Visible = false infobase3.Visible = false droppeddown = false end end script.Parent.MouseButton1Down:connect(infor)
BUT I tried it with THIS which is already visible (=true) but makes it fade in and out, and it doesn't work. I thought there was an easier way to do it, like while variable < 1 do variable = variable +0.1 wait(0.5) end
but it does not work and I have to do it the hard way:
donate = script.Parent.Parent.DonateFrame t = script.Parent.Parent.DonateFrame.BackgroundTransparency local droppeddown = false function donate() if droppeddown == false then script.Parent.Text = "Close Donate" t = 1 t = 0.95 wait(0.1) t = 0.90 wait(0.1) t = 0.85 wait(0.1) t = 0.80 wait(0.1) t = 0.75 wait(0.1) t = 0.70 wait(0.1) t = 0.65 wait(0.1) t = 0.60 wait(0.1) t = 0.55 wait(0.1) t = 0.50 wait(0.1) t = 0.45 droppeddown = true elseif droppeddown == true then script.Parent.Text = "Donate" t = 0.45 wait(0.1) t = 0.50 wait(0.1) t = 0.55 wait(0.1) t = 0.60 wait(0.1) t = 0.65 wait(0.1) t = 0.70 wait(0.1) t = 0.75 wait(0.1) t = 0.80 wait(0.1) t = 0.85 wait(0.1) t = 0.90 wait(0.1) t = 0.95 wait(0.1) t = 1 droppeddown = false end end script.Parent.MouseButton1Down:connect(donate)
Someone please help me... I've had a scorching headache over this and the Extenderframe thing I posted a while ago then deleted (because I gave up on it and nobody was responding) and if you can, help me with the easier way to do it.
Thanks.
It would be easiest using a loop of any sort. As you can see here below, the code was significantly simplified.. Everything is annotated below ..
t = script.Parent.Parent.DonateFrame local droppeddown = false function donate() droppeddown = not droppeddown if droppeddown then -- if condition is true then for i = .45,0.95,.1 do -- start, stop, step --set transparency to position at `i` t.BackgroundTransparency = i wait(.01) end elseif droppeddown == false then -- if condition is anything but true (false/nil) then for i = 0.95,.45,-.1 do -- start, stop, step --set transparency to position at `i` t.BackgroundTransparency = i --step wait(.01) end end end
script.Parent.MouseButton1Down:connect(donate)
script.Parent.MouseButton1Down:connect(donate)