Trying to use TweenService to adjust a local colorcorrectioneffect

local Lighting = Instance.new("ColorCorrectionEffect", game.Lighting).Name = "Colors"
local tweenInfo = TweenInfo.new(12,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,true,1)
local Brightness = game.Lighting.Colors.Brightness

script.Parent.Equipped:Connect(function(Mouse)
    Mouse.Button1Down:Connect(function()
        animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)
		animation:Play()
		local Tween = TweenService:Create(Lighting,TweenInfo, {Brightness = 10})
		Tween:Play()
    end)
end)

script.Parent.Unequipped:Connect(function()
        animation:Stop()
end)

Trying to make it so that the script creates a colorcorrectioneffect while the tool is held, and then when clicked it would adjust the brightness gradually. I keep getting Dictionary errors not sure whats going wrong.

An error is in this line here. You are assigning a property of a variable in the same line that you are trying to assign it to a property. Try seperating it into 2 lines and see if it helps

i.e.

local Lighting = Instance.new("ColorCorrectionEffect", game.Lighting)
Lighting.Name = "Colors"
local Lighting = Instance.new("ColorCorrectionEffect", game.Lighting)
Lighting.Name = "Colors"
local tweenInfo = TweenInfo.new(12,Enum.EasingStyle.Linear,Enum.EasingDirection.InOut,0,true,1)

script.Parent.Equipped:Connect(function(Mouse)
    Mouse.Button1Down:Connect(function()
        animation = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(script.Parent.Animation)
		animation:Play()
		local Tween = TweenService:Create(Lighting,TweenInfo, {Brightness = 10})
		Tween:Play()
    end)
end)

script.Parent.Unequipped:Connect(function()
        animation:Stop()
end)

That did fix the error up top, thanks! Getting a dictionary error still on line 10

On this line here

local Tween = TweenService:Create(Lighting,TweenInfo, {Brightness = 10})

I believe you meant for it to be tweenInfo not TweenInfo

local Tween = TweenService:Create(Lighting,tweenInfo, {Brightness = 10})

Just noticed that a second ago… silly little capitalization errors. Thanks for the help!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.