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

Hi how do I change the transparency of my baseplate?

i = 0

Base = game.Workspace.Baseplate

Base.BrickColor = BrickColor.new("Really red")

while true do

wait(0.1)

Base.Transparency = i

i = i + 0.01

if i > 1 then

i = i - 0.02

print(0)

end

end

i'm not sure how i can revert back my transparency after the baseplate goes to 1

2 answers

Try putting a while loop in your if statement, cause right now, you're only telling it to subtract 0.02 from i only when i is greater than one. So when the while loop starts again, it would add 0.01 back to i, but that. So to fix that:

if i > 1 then
    while true do
    wait(0.01)
    i = i- 0.02
    Base.Transparency = i
    if i < 0 then
	    break
    end
end

1 comment

0

oops there should be another end for the while loop. Just add another end at the end of the script

What you are doing is checking if the base plates transparency goes over one then -.02. But after that you add another .01 because its in a while loop. So it will be stuck at near 1. you have to make sure that the base plate goes back down to zero before it starts adding again.

i = 0
Base = game.Workspace.Baseplate
Base.BrickColor = BrickColor.new("Really red")

while true do

	wait(0.1)
	Base.Transparency = i
	i = i + 0.01
	
	if i >= 1 then
	repeat
		i = i -.02
	until i <= 0
	
		print(0)
	end
end

1 comment

0

The Repeat Until loop just repeats a certain block of code until the condition after the "Until" is met, in this case i will subtract until its less than or equal to zero. Then it will break out of the repeat loop and continue to while loop

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