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

Help with this color script?

Asked by 9 years ago

I don't know why this won't work. It only works the first time. Help?

`while true do
    game.Workspace.e.BrickColor = BrickColor.new(math.random())
    print('color added!')
    wait(0.5)

end`

3 answers

Log in to vote
0
Answered by 9 years ago

e = Instance.new('Part',workspace) e.Size = Vector3.new(3,3,3) wait() --[[while wait(.4) do e.BrickColor = BrickColor.Random() print('Color Added!') wait(.1) end--]]

--[[What I think you did was just take the variable "e" that you named above the script you inserted and use it as the name for the part, when what you should have done is Part.Name = 'e' and then game.Workspace.e because at that point the script looks for a part in the workspace named e rather than looking in the script for a variable named e. Hope it helped--]]

--If you want the printing to stop when the brick is not in the workspace do this --[[ if e then while wait(.4) do e.BrickColor = BrickColor.Random() print('Color Added!') wait(.1) end end --]]

Ad
Log in to vote
0
Answered by 9 years ago

You can replace while true do with while wait(0.5) do, And you can replace math.random() with BrickColor.Random()

while wait(0.5) do
    game.Workspace.e.BrickColor = BrickColor.Random()
end
Log in to vote
0
Answered by 9 years ago
while true do == Also to point out you added ' ~ '
    game.Workspace.e.BrickColor = BrickColor.new(math.random)) -- slash = 2
    print('color added!')
    wait(0.5)

end`

0
Wiat DiamondCookie2 0 — 9y

Answer this question