I don't know what's wrong with this script.
local Part = game.Workspace.Part Part.Transparency = 1 while true do wait(.5) parsttochosefrom = math.random(1,2) if parsttochosefrom == 1 then Part.Transparency = 1 end if parsttochosefrom == 2 then Part.Transpacency = .5 end
on line 10, you spelled "transparency" wrong. Also, try using an elseif statement like this:
local Part = game.Workspace.Part Part.Transparency = 1 while true do wait(.5) parsttochosefrom = math.random(1,2) if parsttochosefrom == 1 then Part.Transparency = 1 elseif parsttochosefrom == 2 then Part.Transparency = .5 end end
There are a few solutions that could help you. These are them:
On line 12 put another "end" to end the while loop.
Throw a math.randomseed(tick()) in there.
Do elseif rather than another if
Try this code and see if it works:
local Part = game.Workspace.Part Part.Transparency = 1 math.randomseed(tick()) -- Makes things more random while true do wait(.5) parsttochosefrom = math.random(1,2) if parsttochosefrom == 1 then Part.Transparency = 1 elseif parsttochosefrom == 2 then -- An elseif here will make the code more smooth and faster Part.Transparency = .5 end end -- You forgot this end here
local Part = game.Workspace.Part Part.Transparency = 1 while true do wait(.5) parsttochosefrom = math.random(1,2) if parsttochosefrom == 1 then Part.Transparency = 1 end if parsttochosefrom == 2 then Part.Transpacency = .5 end
PLEASE MARK THIS HELPFUL, DON'T JUST TAKE SCRIPT AND GO