Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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

2 comments

0

For some reason that script is not working because it's expecting an = sign near the do.

0

Edited, look at the second one. :)

This discussion is preserved as it was. New answers, comments, and votes are closed.