I'm new to Lua, this is my first script:
local Close = script.Parent.Parent.Parent.Parent.Close
local ClosingVAL = script.Parent.ClosingVAL
local ClosingVAL = Close.Disabled.False
If Closing=true then
wait (1) then script.Parent.Material = "Neon"
wait (1) then script.Parent.Material = "SmmothPlastic"
wait (1) then script.Parent.Material = "Neon"
wait (1) then script.Parent.Material = "SmmothPlastic"
wait (1) then script.Parent.Material = "Neon"
wait (1) then script.Parent.Material = "SmmothPlastic"
wait (1) then script.Parent.Material = "Neon"
wait (1) then script.Parent.Material = "SmmothPlastic"
end
end
This is a regular scirpt, inside a Part. I didn't test this yet, but the expected outcome is for the parent of the script to change materials (and thus "blink") every one second. Should I make the wait time shorter? Will Studio even be able to recognize and successfully execute this script?
PS: ignore that 1| before the first end there, I have no idea how to get rid of it.
Like this, Geobloxia?
[(https://drive.google.com/file/d/1Goww0BE4GW1b7IzKJyv2Ux7EMLg9prVn/view?usp=sharing)]
It will not work because for some reasons. Also, I didn't see the variable "Closing" to be defined in this script. That is also another reason. You have to define it. 1st reason: script.Parent.Material = SmoothPlastic will not work. You have to use enum:
script.Parent.Material = Enum.Material.SmoothPlastic -- enumeration, is sometimes shortened to enum
2nd reason: You do not do wait(1) then. Do this:
wait(1) -- waits before proceeding to next line script.Parent.Material = Enum.Material.SmoothPlastic
If you want it to keep repeating while Closing is true, use a while loop like this:
while closing == true do wait (1) -- don't add a "then" after waits. script.Parent.Material = "Neon" wait (1) script.Parent.Material = "SmoothPlastic" wait (1) script.Parent.Material = "Neon" wait (1) script.Parent.Material = "SmoothPlastic" wait (1) script.Parent.Material = "Neon" wait (1) script.Parent.Material = "SmoothPlastic" wait (1) script.Parent.Material = "Neon" wait (1) script.Parent.Material = "SmoothPlastic" end -- make sure you add a wait cooldown for while loops, -- so they don't crash
For more information: https://developer.roblox.com/en-us/api-reference/property/BasePart/Material For material https://developer.roblox.com/en-us/articles/Loops/index.html For while loops and other loops.