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
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.
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