ColorCorrection not tweening

I have a script in StarterCharacterScripts that makes players ragdoll when damaged. The time they are ragdolled for is based off of the damage amount. The script also sends a value through a remote event to the client in order to tween a blur effect and a colorcorrection, but the colorcorrection doesnt seem to be tweening. I know that its not the speed of the tween because the blur effect works and they share the same tween info. Please help!

Code:

local RemoteEvent = script.Parent.RemoteEvent
local TweenService = game:GetService("TweenService")
local Lighting = game:GetService("Lighting")
local Blur = Lighting:FindFirstChild("Blur")
local ScreenColor = Lighting:FindFirstChild("ScreenColor")

local BPT1 = {}
BPT1.Size = 35

local BPT2 = {}
BPT2.Size = 0

local SPT1:ColorCorrectionEffect = {}
SPT1.Brightness = 0.15
SPT1.Contrast = 1.6
SPT1.Saturation = 0.5
SPT1.TintColor = Color3.new(.9, .1, .1)

local SPT2:ColorCorrectionEffect = {}
SPT1.Brightness = 0
SPT1.Contrast = 0
SPT1.Saturation = 0
SPT1.TintColor = Color3.new(1, 1, 1)

local TI1 = TweenInfo.new(.1)

RemoteEvent.OnClientEvent:Connect(function(Time)
	local TI2 = TweenInfo.new(Time)
	
	local BTween1 = TweenService:Create(Blur, TI1, BPT1)
	local BTween2 = TweenService:Create(Blur, TI2, BPT2)
	
	local STween1 = TweenService:Create(ScreenColor, TI1, SPT1)
	local STween2 = TweenService:Create(ScreenColor, TI2, SPT2)
	
	BTween1:Play()
	BTween1.Completed:Connect(function()
		BTween2:Play()
	end)
	STween1:Play()
	STween1.Completed:Connect(function()
		STween2:Play()
	end)
end)

Edit: Incase its needed, heres the serverscript:

local RemoteEvent = script.RemoteEvent

local Character = script.Parent
local Humanoid:Humanoid = Character:WaitForChild("Humanoid")
local OldHealth = Humanoid.Health

local IsRagdoll = Character:FindFirstChild("IsRagdoll")

Humanoid.HealthChanged:Connect(function(Health)
	if Health < OldHealth then
		local damage = OldHealth - Health
		print("Damaged! "..damage)
		print(OldHealth)
		print(Health)
		if damage > 20 then
			IsRagdoll.Value = true
			RemoteEvent:FireClient(game.Players:GetPlayerFromCharacter(Character), math.min(20, math.max(1, damage/10)))
			wait(damage/20)
			IsRagdoll.Value = false
		end
		OldHealth = Health
	end
end)

Figured it out! When setting my variables in the property table “PT2” i set the variables for PT1 instead.

1 Like

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