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

How about a SurfaceLight color that equals to brick color?

Asked by
Burobuu 18
6 years ago

Working with some lighting for a friends game but I have continued to fail to have my lights match their brick color. The brick color pattern is there below. I tried to change it so the lights color would have the same pattern. Of course it didn't work ,_,

while true do
wait(0.5)
script.Parent.Color = BrickColor.new("Bright red")
wait(0.5)
script.Parent.Color = BrickColor.new("Bright orange")
wait(0.5)
script.Parent.Color = BrickColor.new("Bright yellow")
wait(0.5)
script.Parent.Color = BrickColor.new("Bright green")
wait(0.5)
script.Parent.Color = BrickColor.new("Bright blue")
wait(0.5)
script.Parent.Color = BrickColor.new("Bright violet")
end

2 answers

Log in to vote
1
Answered by
Leamir 3138 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

Hello, honoroll123!

You can use this script:

while wait(.1) do
    script.Parent.Color = script.Parent.Parent.Color -- sets light color to it's parent's color
end

don't forget to make the script a child of the light =D

Good Luck with your games!!

0
...I feel dumb now Burobuu 18 — 6y
0
Don't feel dumb, you're a new scripter, not dumb Leamir 3138 — 6y
Ad
Log in to vote
0
Answered by 6 years ago

While Leamir's answer is valid and correct, it would be much more efficient to do

script.Parent.Parent:Changed:Connect(function(property)
    if property == "Color" then
        script.Parent.Color = script.Parent.Parent.Color
    end
end)
0
Or even better yet, change both the light and brick's color at the same time User#1007 6 — 6y

Answer this question