Help with changing beam color smoothly

local hrp = script.Parent.HumanoidRootPart
script.Parent:FindFirstChild("Humanoid").BreakJointsOnDeath = false

local Beams = game.Workspace.Spawn.Lights

game:GetService("RunService").Heartbeat:Connect(function()
	local ray = Ray.new(hrp.Position, hrp.CFrame.UpVector* -500)
	local part = workspace:FindPartOnRayWithWhitelist(ray, {workspace.Spawn.SpawnPlatform})
	if part then
		if hrp.Parent:FindFirstChild("ForceField") then
		else
			local forcefield = Instance.new("ForceField")
			forcefield.Visible = false
			forcefield.Parent = hrp.Parent
		end
	else
		if hrp and hrp.Parent then
			if hrp.Parent:FindFirstChild("ForceField") then
				hrp.Parent:FindFirstChild("ForceField"):Destroy()
			end
		end
	end
end)

This is my script for a safezone, in Beams there are 4 children named ‘Beam1,Beam2,Beam3,Beam4’ i want it so when you are safe (have a forcefield) the beams are light blue and when you’re not they’re red and i want it to smoothly change from blue to red and able to be switch mid-tween (u can quickly go in and out of the safezone while u the tween is playing)

1 Like