warycoolio
(warycoolio)
October 13, 2020, 4:24am
#1
I’m trying to make a flickering light script, but i’m getting an error: 21:22:11.849 - Workspace.Part.Script:5: attempt to call a Color3 value
Extra information: The part has a pointlight attached to it, and the script is in the part. It’s not a local script
local lol = true
while lol == true do
wait(2)
script.Parent.PointLight.Brightness = 0.3
script.Parent.BrickColor.Color(0,0,0)
wait(0.7)
script.Parent.BrickColor.Color(200,200,0)
script.Parent.PointLight.Brightness = 0.7
wait(0.6)
script.Parent.BrickColor.Color(255,255,0)
script.Parent.PointLight.Brightness = 1
wait()
repeat
until
lol == false
end
1 Like
You will have to set the BrickColor.Color this way, I believe:
script.Parent.BrickColor.Color = Color3.fromRGB(0,0,0)
3 Likes
Haydz6
(Cookie)
October 13, 2020, 4:30am
#3
That won’t work as you aren’t assigning the variable. Also to set Color with Color.fromRGB() you have to do Part.Color
script.Parent.Color = Color3.fromRGB(0,0,0)
warycoolio
(warycoolio)
October 13, 2020, 4:31am
#4
1 Like
My bad, I just realized it is a non assignable property, you could just go with what @Haydz6 has mentioned, it should work fine.
Except his script has a small error, as he has referenced Color.fromRGB, it should be Color3.fromRGB instead
2 Likes
Haydz6
(Cookie)
October 13, 2020, 4:34am
#6
Thank you for pointing that out.
warycoolio
(warycoolio)
October 13, 2020, 4:34am
#7
Haydz6
(Cookie)
October 13, 2020, 4:35am
#8
You have
repeat
until
lol == false
Without a wait. Is that to try and end the while true do loop?
warycoolio
(warycoolio)
October 13, 2020, 4:36am
#9
Alright, no errors after adding the wait() after repeat, but the color doesnt change
1 Like
Haydz6
(Cookie)
October 13, 2020, 4:37am
#10
It never changes again because the
repeat until lol == false
Condition is never met
If that is meant to end the loop, you can do this instead
local lol = true
while true do
if lol == false then --if lol == true then it will not end the loop and it will continue
break --ends the loop if lol == false and the loop will not continue
end
wait(2)
script.Parent.PointLight.Brightness = 0.3
script.Parent.BrickColor.Color(0,0,0)
wait(0.7)
script.Parent.BrickColor.Color(200,200,0)
script.Parent.PointLight.Brightness = 0.7
wait(0.6)
script.Parent.BrickColor.Color(255,255,0)
script.Parent.PointLight.Brightness = 1
end
warycoolio
(warycoolio)
October 13, 2020, 4:38am
#11
I made it would never become false, so it would keep repeating, right?
Haydz6
(Cookie)
October 13, 2020, 4:39am
#12
Yes, I went ahead and fixed it. It will now end when lol becomes false
warycoolio
(warycoolio)
October 13, 2020, 4:41am
#13
local lol = true
while true do
if lol == false then
break
end
wait(2)
script.Parent.PointLight.Brightness = 0.3
script.Parent.BrickColor.Color = Color3.fromRGB(0,0,0)
wait(0.7)
script.Parent.BrickColor.Color = Color3.fromRGB(200,200,0)
script.Parent.PointLight.Brightness = 0.7
wait(0.6)
script.Parent.BrickColor.Color = Color3.fromRGB(255,255,0)
script.Parent.PointLight.Brightness = 1
end
I added the Color3 thing, because it said attempt to call a color3 value, now it says 21:40:08.971 - Color cannot be assigned to again.
Haydz6
(Cookie)
October 13, 2020, 4:41am
#14
local lol = true
while true do
if lol == false then
break
end
wait(2)
script.Parent.PointLight.Brightness = 0.3
script.Parent.Color = Color3.fromRGB(0,0,0)
wait(0.7)
script.Parent.Color = Color3.fromRGB(200,200,0)
script.Parent.PointLight.Brightness = 0.7
wait(0.6)
script.Parent.Color = Color3.fromRGB(255,255,0)
script.Parent.PointLight.Brightness = 1
end
Accidentally took the other one, fixed it.
1 Like