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

Beginner Scripter: I need help with this script. I'm very confused on what to do. Can you help me?

So basically, I'm new to scripting, and what I'm trying to do is make a block disappear slowly. May you please help me?

This is the script I need help with:

local test3 = workspace.Part3

if test3.Transparency == 0 then
    while wait(0.01) do
    test3.Transparency + 0.01 until
    test3.Transparency = 1
end  

3 answers

✓ Accepted answer
local test3 = game.workspace.Part3 -- You forgot a game
local i = 0

if test3.Transparency == 0 then
  while i<=100 do
    test3.Transparency = test3.Transparency + 0.01 -- Some things didn't make sense.
    i = i + 1
    wait(0.05)
  end
end

You should not use until, as it is only there for repeats. Try this:

local test3 = workspace.Part3

if test3.Transparency == 0 then
	repeat
		test3.Transparency = test3.Transparency + 0.01
		wait()
	until test3.Transparency => 1
end  

Repeats will repeat the code inside it until it meets a certain criteria. Also, note that 0.2999999999999999 (0.3) is the minimum wait time allowed on wait()'s.

10 comments

0

Okay. Thank you so much!

0

No problem.

0

Feel free to mark my question as the answer to the question.

0

I got you.

0

wait but looking at that, wouldn't line 5 increase transparency + 0.01 and then line 6 make it 1 making the repeat end immediately

0

also im pretty sure line 8 and 9 need to be in the same line to work

0

No, they don't have to, and you did set the test3 transparency to 1, so..

0

I just edited my answer so it should work

0

1st of all you are mistaking the persons, 2nd of all you just made it worse and 3rd of all apparently this guy doesn't know how to do it on his own so instead of taking his script for true just read what he is trying to do

0

I did not take his script. And how am I making it worse? Just because I made a mistake doesn't mean you have to scold me for making one. Everyone makes mistakes.

you could use while or repeat also to set the Transparency to Transparency+0.01 you need to add Transparency=Transparency+0.01

local test3 = workspace.Part3

if test3.Transparency == 0 then
   repeat
  test3.Transparency=test3.Transparency+ 0.01 
wait(0.01)
    until test3.Transparency >= 1 --the ">" just if it goes over 1
end 
--or 
if test3.Transparency == 0 then
  while test3.Transparency< 1 do
  test3.Transparency=test3.Transparency+ 0.01 
wait(0.01)
    end
end 


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