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

How could I make this reflective loop script run in the workspace?

Asked by 10 years ago

local brick = Workspace.brick // I am trying for this to detect a part called "brick" within the workspace.

while true do

wait(0.1)

script.Parent.BrickColor = BrickColor.new("New Yeller")

script.Parent.Reflectance= 0.1

wait(0.1)

script.Parent.Reflectance= 0.2

wait(0.1)

script.Parent.Reflectance= 0.3

wait(0.1)

script.Parent.Reflectance= 0.4

wait(0.1)

script.Parent.Reflectance= 0.5

wait(0.1)

script.Parent.Reflectance= 0.6

wait(0.1)

script.Parent.Reflectance= 0.7

wait(0.1)

script.Parent.Reflectance= 0.8

wait(0.1)

script.Parent.Reflectance= 0.9

wait(0.1)

script.Parent.BrickColor = BrickColor.new("Institutional white")

script.Parent.Reflectance= 1

end

1 answer

Log in to vote
0
Answered by
Asirix 15
10 years ago

Try something like this?

brick = game.Workspace["Brick"]
Reflect = script.Parent.Reflectance
Reflect = 0.1

Wait(0.1)
while script.Parent.BrickColor = BrickColor.new("New Yeller") do
Reflect = (Reflect + 0.1)  -- Or you could do Reflect = Reflect + 0.1
if Reflect = 1 then
    scrip.Parent.BrickColor = BrickColor.new("Institutional white") 
Wait(0.1)
Reflect = (Reflect - 0.9) -- Same with earlier.
end

HERE, do this instead.

Reflect = script.Parent.Reflectance
Reflect = 0.1

Wait(0.1)
while true do
script.Parent.BrickColor = BrickColor.new("New Yeller") 
Reflect = (Reflect + 0.1)  -- Or you could do Reflect = Reflect + 0.1
if Reflect == 1 then
    scrip.Parent.BrickColor = BrickColor.new("Institutional white") 
Wait(0.1)
Reflect = (Reflect - 0.9) -- Same with earlier.
end
end
0
For some reason that script is not working because it's expecting an = sign near the do. ShadowMorel 0 — 10y
0
Edited, look at the second one. :) Asirix 15 — 10y
Ad

Answer this question