if game.workspace.Baseplate.Transparency = 0 add 0.1 <- The part where it adds .1 to the 0 end if game.workspace.Baseplate.Transparency = 1.0 then game.workspace.Baseplate.Transparency = 0 end
It is for some reason not working and output is claiming it's near the first =
if game.workspace.Baseplate.Transparency = 0 add 0.1 <- The part where it adds .1 to the 0 end
if game.workspace.Baseplate.Transparency = 1.0 then
game.workspace.Baseplate.Transparency = 0
end
How do I fix this.
while wait() do if game.Workspace.Baseplate.Transparency < 1 then game.Workspace.Baseplate.Transparency = game.Workspace.Baseplate.Transparency + .1 end if game.Workspace.Baseplate.Transparency == 1.0 then game.Workspace.Baseplate.Transparency = 0 end end --Fixed script if you wanna skip explanation
That other answer didn't tell you anything.
Here is what was wrong
You were using game.workspace instead of game.Workspace Lua is case-sensitive so you have to have the correct name!
You were trying to execute Add (?) I assume you were trying to add to the transparency, so yeah.
You were also using = . to compare, you have to say '=='
You forgot the then after the first if statement, so there's that. You were also comparing to see if it was at 0, which if it was it would never fire any of the if statements.
So I set that to be while it's under 1 (last update it'll be .9(lower) + .1)
And finally, you forgot a loop. It'd check once and never fire again. If this doesn't work, please tell me.
Use == to compare things.
if game.workspace.Baseplate.Transparency == 1.0 then
Don't worry, I'm a beginner and I tried using conditional statement
if game.workspace.Baseplate.Transparency = 0 add 0.1 <- The part where it adds .1 to the 0 end if game.workspace.Baseplate.Transparency = 1.0 then game.workspace.Baseplate.Transparency = 0 end
Wheeze...
Okay, let's start down with the basics.
-- || Services || local Workspace = game:GetService("Workspace") -- Always do that it's a good habit. -- || Learn Conditional Statements || while wait() do while Workspace.Baseplate.Transparency < 1 do Workspace.Baseplate.Transparency = Workspace.Baseplate.Transparency + 0.1 -- You tried to call ADD when that doesn't exist. You -Could- make a function called add, but that's a waste of time. wait() end while Workspace.Baseplate.Transparency => 1 do Workspace.Baseplate.Transparency = 0 wait() end end -- Yes, I made this very sloppily intentionally.
Let's say you made a function called Add.
local function Add(Value, Number) Value = Value + Number end while wait() do while Workspace.Baseplate.Transparency < 1 do Add(Workspace.Baseplate.Transparency, 0.1) -- There. wait() end while Workspace.Baseplate.Transparency => 1 do Add(Workspace.Baseplate.Transparency, -1) -- There again. :P wait() end end
** Anyways, done being rude, time for an actual answer.**
Okay, so you need to understand something called Conditional Statements, you probably learned these in Mathematics. (Unless you sleep in that class. Cough)
Conditional States are as followed:
(Greater Than) < (Less Than) = (Equal To (In Math... In Programming it's for setting a value or something.)) >= (Greater Than or Equal To) <= (Less Than or Equal To) == (Equal To for If Than Statements.) ~= (Not Equal To)
You also don't know how to call the Math stuff in rbx.lua. Which is fine! Programming takes practice, lemme show you the symbols:
(+) is Adding
(-) is Subtracting
(*) is Multiplying
(/) is Dividing
(%) is Dividing with a Remainder (Basically)
If you have any other questions. Just let me know. :P