Sorry to say, but you may need to read up more on the for loops here.
First, if you haven't realized, but your for loops are WAY off.
for i = 1, 0.25 do
Above is a big NO NO! Never try this, it will not work, the smaller number, .25, MUST come before the larger number, 1.
Since your code isn't very effective, I'm going to start from scratch. First, we'll declare the button variable!
button = script.Parent
Simple right? Next, we'll add the infinite loop in the script.
button = script.Parent
while(true) do
end
That was easy too, but let's get to the part you weren't sure of! From what I understand you're attempting to go from .5 transparency to 1, back to .5 and then repeat that, yes?
button = script.Parent
while(true) do
if(button.BackgroundTransparency <= 0.5)
else
end
end
Above we added a function to see if the transparency is less than or equal to 0.5, and if so, we'll make it go to 1, else it will go down to 0.5!
button = script.Parent
while(true) do
if(button.BackgroundTransparency <= 0.5)
while(button.BackgroundTransparency < 1) do
button.BackgroundTransparency = button.BackgroundTransparency + 0.02
wait(0.1)
end
else
while(button.BackgroundTransparency > 0.5) do
button.BackgroundTransparency = button.BackgroundTransparency - 0.02
wait(0.1)
end
end
end
This is the finished code. The while loops ensure that the transparency is what we want it to be! Hopefully this will work, but I can't ensure it because I've been programming in Java for the past month, so I may have messed up!
3 comments
Anyone ?..
Bulvyte: if you're getting red lines on legobuildermaster's script, you need to hover over the script and click "Copy to clipboard" -- a button that appears at the top right of the script. Otherwise you'll still have the line #s, which Roblox doesn't accept.
I did that.... heres a screenshot : http://prntscr.com/8aiygf but anyway im gonna see yours now