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

Spotlight Color Change? Rainbow Light??

how can i make the beam change color NOTE: THIS script is placed in the beam:


local SECONDS_PER_LOOP = 5
while true do
    script.Parent.Color = Color3.fromHSV((tick()/SECONDS_PER_LOOP)%1,1,1)
    wait(1)
end

for some reason it stays the same color and i want it to change Can i have some help??

2 answers

use ColorSequence, not Color3

local SECONDS_PER_LOOP = 5
while true do
	local color = Color3.fromHSV((tick()/SECONDS_PER_LOOP)%1,1,1)
	script.Parent.Color = ColorSequence.new(color, color)
	wait(1)
end

1 comment

0

yes but if i put this script in my other beam it doesnt match colors when it changes how can i make it match?

Use a script to manage all the beams at once.

local SECONDS_PER_LOOP = (5);
local swait = function(...) return game:GetService("RunService").Stepped:Wait(...) end
while wait(1) do
	for i,v in next,(workspace:GetDescendants()) do
		if v:IsA("Beam") and v.Name == "Name of your beam" then
			v.Color = ColorSequence.new(Color3.fromHSV((tick()/SECONDS_PER_LOOP)%1,1,1))
		end
	end
end

1 comment

0

Where do i put this script? Note in workspace i have a folder called "Spotlight" and in that spotlight folder are my models all named "Spotlight_!" and in them is the beam part and in the part ius the beam so wat should i do

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