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

Why Is This Script Not Working: Changing Beam Color? (Note: Im New To scripting ish)

Asked by 4 years ago
Edited 4 years ago

So im trying to make my spotlight beam change color (in a rainbow form) and ive placed the script in the part where the beam is located in.

why is it not changing the beam color? Note: im trying to make my stage spotlight change colors Script: while true do script.Parent.light = Color3.new(math.random(), math.random(), math.random()) wait(1) end

0
Here if you wanted to change smoke color or part color rainbow: local text = script.Parent local add = 10 wait(1) local k = 1 while k <= 255 do text.Color = Color3.new(k/255,0/255,0/255) k = k + add wait() end while true do k = 1 while k <= 255 do text.Color = Color3.new(255/255,k/255,0/255) k = k + add wait() end k = 1 while k <= 255 do text.Color = Color3.new(255/255 - k/255,255/255,0/255) k = k 7zjh 146 — 4y
0
I made a variable I called "k" 7zjh 146 — 4y

2 answers

Log in to vote
2
Answered by 4 years ago
Edited 4 years ago

You forgot to put .Color when defining the light, so you script would look like this

while true do
    script.Parent.light.Color = Color3.new(math.random(), math.random(), math.random()) 
    wait(1)
end

EDIT: I'm still quite confused on what you are asking, but If I'm understanding right this should work

while true do
    script.Parent.Color = ColorSequence.new(Color3.fromRGB(math.random(0,255),math.random(0,255),math.random(0,255)),Color3.fromRGB(math.random(0,255),math.random(0,255),math.random(0,255))) 
    wait(1)
end
0
Where is the script currently? jediplocoon 877 — 4y
0
ok so i have a folder called "spots" and i have my "spotlight_!" model and in there is my "body" model and in that body model i have my part "beam" and in there is the beam and the pointlight how could i make the actual beam change rainbow color? forsakern 12 — 4y
0
my script is in the body model where all the parts like "lens" and beam are at forsakern 12 — 4y
0
should i put the script where the actual beam is? forsakern 12 — 4y
View all comments (8 more)
0
and im confused cause in ur script u put color but its a beam forsakern 12 — 4y
0
Wait, so do you want to change the beams color or the lightpoints color? jediplocoon 877 — 4y
0
well i want to change the beam of the spotlight rainbow forsakern 12 — 4y
0
because my game is a nightclub game iand im wanting to change the stage spotlights beam rainbow forsakern 12 — 4y
0
i want to change the stage spotlight beam to a color changing rainbow forsakern 12 — 4y
0
THX U HELPED ME!!! UR KING forsakern 12 — 4y
0
lol, that's what this is for anyways, isn't it? helping other ppl out jediplocoon 877 — 4y
0
also, remember to make this your answer so people don't spend time trying to fix it when we already solved the problem. jediplocoon 877 — 4y
Ad
Log in to vote
0
Answered by
7zjh 146
4 years ago
Edited by JesseSong 2 years ago

Please encode Lua code in the Lua block code tag (look for the Lua icon in the editor).

I made this script for the parts if you were interested in making rainbow parts, this script should also work for smoke. Sadly, this script does not work for Beams, here is the script I made:

local text = script.Parent
local add = 10
wait(1)
local k = 1
while k <= 255 do
text.Color = Color3.new(k/255,0/255,0/255)
k = k + add
wait()
end
while true do
k = 1
while k <= 255 do
text.Color = Color3.new(255/255,k/255,0/255)
k = k + add
wait()
end
k = 1
while k <= 255 do
text.Color = Color3.new(255/255 - k/255,255/255,0/255)
k = k + add
wait()
end
k = 1
while k <= 255 do
text.Color = Color3.new(0/255,255/255,k/255)
k = k + add
wait()
end
k = 1
while k <= 255 do
text.Color = Color3.new(0/255,255/255 - k/255,255/255)
k = k + add
wait()
end
k = 1
while k <= 255 do
text.Color = Color3.new(k/255,0/255,255/255)
k = k + add
wait()
end
k = 1
while k <= 255 do
text.Color = Color3.new(255/255,0/255,255/255 - k/255)
k = k + add
wait()
end
while k <= 255 do
text.Color = Color3.new(255/255 - k/255,0/255,0/255)
k = k + add
wait()
end
end

0
jesus JesseSong 3916 — 2y

Answer this question