Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago
Edited 4 years ago

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

Log in to vote
0
Answered by
6zk8 95
4 years ago
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
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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.

0
Okay. Thank you so much! PumpyTooClouted 4 — 4y
0
No problem. youtubemasterWOW 2741 — 4y
0
Feel free to mark my question as the answer to the question. youtubemasterWOW 2741 — 4y
0
I got you. PumpyTooClouted 4 — 4y
View all comments (6 more)
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 richboifexekappa 89 — 4y
0
also im pretty sure line 8 and 9 need to be in the same line to work richboifexekappa 89 — 4y
0
No, they don't have to, and you did set the test3 transparency to 1, so.. youtubemasterWOW 2741 — 4y
0
I just edited my answer so it should work youtubemasterWOW 2741 — 4y
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 richboifexekappa 89 — 4y
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. youtubemasterWOW 2741 — 4y
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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 


Answer this question