Rainbow Color correction

So I’m making this tool where if you activated it, it will duplicate a color correction from the tool itself and put it in lighting so it’s a client only. But How do i make the color correction rainbow? I have tried putting a script inside of it and making it disabled and when it clones the Color correction to lighting it enables the script but it doesn’t seem to work. Here is the script inside the tool:

local DB = false
local tool = script.Parent
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/Asset?ID=6947444958" 

local track


tool.Activated:Connect(function()
	if not DB then
		DB = true
		tool.Handle.CWeld:Destroy()
		tool.Handle.Cork.Pop:Play()
		wait(1)
		track = script.Parent.Parent.Humanoid:LoadAnimation(anim)
		track.Priority = Enum.AnimationPriority.Action
		track.Looped = false
		track:Play()
		wait(0.5)
		tool.Handle.DrinkSound:Play()
		wait(3)
		tool.Handle.Part.Transparency = 1
		wait(math.random(10,25))
		local ts = game:GetService("TweenService")
		local cam = workspace.CurrentCamera

		local Time = 53

		local AppleShade = tool.AppleJuice:Clone()
		local Color = AppleShade.Color
		ts:Create(cam, TweenInfo.new(Time), {FieldOfView = 120}):Play()
		game.SoundService.Blank:Play()
		game.SoundService.Music:Pause()
		AppleShade.Parent = game.Lighting
		wait(0.1)
		Color.Enabled = true
		wait(53)
		game.SoundService.Music:Resume()
		game.SoundService.Blank:Stop()
		cam.FieldOfView = 70
		AppleShade:Destroy()
		DB = false
		tool:Destroy()
	end
end)

and this is the script inside the color correction:

local CC = game.Lighting:WaitForChild("AppleJuice")

while true do
	for i = 0,1,0.01 do
		CC.TintColor = Color3.fromHSV(i,1,1)
		wait(0.1)
	end
end

but int he end i get an error saying:

Enabled is not a valid member of Script “Lighting.AppleJuice.Color” - Client - ClientHandler:36

1 Like

There is an ambiguity of the name Color and I do not know whether you are referencing an instance or the property itself. Also what is Color anyways?

1 Like

AppleShare.Color. Color is the script name inside oh the cc

Do you mean disabled instead of enabled? Scripts use disabled.

2 Likes

Try this rainbow script:

function zigzag(X)
	return math.acos(math.cos(X*math.pi))/math.pi
end
counter = 0

while wait(0.03) do
	CC.TintColor = Color3.fromHSV(zigzag(counter),1,1)
	counter = counter + 0.01
end

It works in the tool but it doesn’t work when it’s in lighting

Yes, that has to be because LocalScripts only work when parented under a Player object, the player’s character, or ReplicatedFirst. This is because LocalScripts run on the clients.

well, what can I do to make it rainbow then? Since I cant use the script. The script inside the Color Correction isn’t A Local Script