Issue with raycast

I want to make a ray cast for a laser that burns the character if detected, however, around this point:


if you’re on top of the elevator and go and touch the laser, nothing happens, no player burned, which is strange because when the elevator was at a higher position it would burn the character.
I’ve tried changing the direction position to see if that changes anything but to no avail, I do not know what else to do. Also, when im printing the hitpart position, the printed position freezes even though the elevator is moving, as soon as this position freezes and I walk on top of the laser, touching it, I don’t get burned. This is my script:

function characterBurner()
	local tweenInfo = TweenInfo.new(
		5,
		Enum.EasingStyle.Linear			
	)
	repeat 
		task.wait()
		local characters = {}
		for _, v in next, game.Players:GetPlayers() do
			table.insert(characters, v.Character)
		end
		local rayOrigin = elevatorChamber.Parent.Laser2.Laser.Position
		local rayDirection = Vector3.new(0, -102, 0)
		raycastParams.FilterDescendantsInstances = {elevatorChamber.laserAbsorber, characters}
		raycastParams.FilterType = Enum.RaycastFilterType.Whitelist
		local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
		local rayOrigin2 = elevatorChamber.Parent.Laser.Laser.Position
		local rayDirection2 = Vector3.new(0, 28, 0)
		raycastParams2.FilterDescendantsInstances = {elevatorChamber.laserAbsorber2, characters}
		raycastParams2.FilterType = Enum.RaycastFilterType.Whitelist
		local raycastResult2 = workspace:Raycast(rayOrigin2, rayDirection2, raycastParams2)
		if raycastResult then
			local hitPart = raycastResult.Instance
			if hitPart:FindFirstAncestorWhichIsA("Model") then
				local character = hitPart:FindFirstAncestorWhichIsA("Model")
				if character:FindFirstChild("Humanoid") then
					if not character.HumanoidRootPart:FindFirstChild("Fire") then
						local fire = Instance.new("Fire")
						fire.Parent = character.HumanoidRootPart
						local sound = Instance.new("Sound")
						sound.SoundId = "rbxassetid://138077028"
						sound.Parent = character.HumanoidRootPart
						sound.Volume = 1
						sound.RollOffMaxDistance = 100
						sound:Play()
						local immolation = function()
							while character.Humanoid.Health ~= 0 do
								for _, v in next, character:GetChildren() do
									if v:IsA("BasePart") then
										local Goal = {Color = Color3.fromRGB(255, 0, 0)}
										tweenService:Create(v, tweenInfo, Goal):Play()
									end
								end
								character.Humanoid.Health -= damageIncriment
								task.wait(waitTime)
							end
						end
						task.spawn(immolation)
					end
				end
			end
		end
		if raycastResult2 then
			local hitPart = raycastResult2.Instance
			print(hitPart.Parent, hitPart.Position)
			if hitPart:FindFirstAncestorWhichIsA("Model") then
				local character = hitPart:FindFirstAncestorWhichIsA("Model")
				if character:FindFirstChild("Humanoid") then
					print("found humanoid")
					if not character.HumanoidRootPart:FindFirstChild("Fire") then
						local fire = Instance.new("Fire")
						fire.Parent = character.HumanoidRootPart
						local sound = Instance.new("Sound")
						sound.SoundId = "rbxassetid://138077028"
						sound.Parent = character.HumanoidRootPart
						sound.Volume = 1
						sound.RollOffMaxDistance = 100
						sound:Play()
						local immolation = function()
							while character.Humanoid.Health ~= 0 do
								for _, v in next, character:GetChildren() do
									if v:IsA("BasePart") then
										local Goal = {Color = Color3.fromRGB(255, 0, 0)}
										tweenService:Create(v, tweenInfo, Goal):Play()
									end
								end
								character.Humanoid.Health -= damageIncriment
								task.wait(waitTime)
							end
						end
						task.spawn(immolation)
					end
				end
			end
		end
	until elevatorChamber.Laser.Attachment.Beam.Enabled == false
end

laserAbsorber position: (-61.643, 92.958, 650.23)
laserAbsorber2 position: (-61.643, 28.083, 650.23)
Printed position of when laserAbsorber.Position freezes even though the elevator
the elevator is moving: (-61.643001556396484, 14.552589416503906, 650.22998046875)
Position of the elevator before it starts moving (this is the position of where the elevator is tweened to): -61.643, 28.87, 650.23
Position of the elevator once it reaches the bottom: (-61.643, -168.877, 650.23)
This is an image of “laserAbsorber” (I know my script can use some more functions to keep cleaner but I’ll do that later once I find a solution to this issue)

Well, first I thought it was because the Fire instance was still in the HRP but I notice now that the character is burned until they die. So perhaps this is a network ownership and replication problem. You did say the position value froze. Try obtaining the position value from the CFrame of the laser part or running the code from a local script to see if that makes any difference.

A good way to try and figure out what’s wrong with your raycasts is to visualize them to see if or where the math went wrong.
This is the function I use

local Debris = game:GetService("Debris") --//Delete this if you already have debris
function DrawRay(PointA, PointB, Lifespan, Color) --//Color is a Color3
	if not workspace:FindFirstChild("Debug") then --//Generating the part the attachments go into
		local Debug = Instance.new("Part", workspace)
		Debug.Position = Vector3.new(0,0,0)
		Debug.Transparency = 1
		Debug.CanCollide = false
		Debug.Anchored = true
	end
	Color = Color or Color3.fromRGB(255, 0, 0) --//Default color is red
	local AttachA = Instance.new("Attachment", workspace.Debug)
	local AttachB = Instance.new("Attachment", workspace.Debug) --//The two attachments
	AttachA.Position = PointA
	AttachB.Position = PointB --//Setting their position
	local Beam = Instance.new("Beam", AttachA)
	Beam.FaceCamera = true
	Beam.Color = ColorSequence.new(Color)
	Beam.Width0 = 0.1 Beam.Width1 = 0.02 --//One end is thinner to show direction
	Beam.Attachment0 = AttachA
	Beam.Attachment1 = AttachB --//Setting up the raycast
	if not Lifespan then return {AttachA, AttachB} end
	Debris:AddItem(AttachA, Lifespan)
	Debris:AddItem(AttachB, Lifespan) --//Giving them a debris
end

Lets take one of your raycasts, like the first one.

local raycastResult = workspace:Raycast(rayOrigin, rayDirection, raycastParams)
--//Now to visualize
DrawRay(rayOrigin, rayOrigin+rayDirection, 0.2) --//will make a line that should follow the ray

I hope this can help you debug your function.