Help with raycast laser

  1. What do you want to achieve?
    making a laser attachment that can work on any parent

  2. What is the issue?
    i scripted a laser and it work but when i put it somewhere else when playing it not work

when i change the parent

when i put on workspace

local NormalPart = script.Parent.Parent.Hitt
local RayPart = script.Parent

local MaxRayLength = 50

local rayP =
rayP.FilterType = Enum.RaycastFilterType.Blacklist
rayP.FilterDescendantsInstances = {RayPart, NormalPart}
rayP.IgnoreWater = true

while wait() do
		local result = workspace:Raycast(RayPart.Position, RayPart.CFrame.LookVector * MaxRayLength, rayP)
	if result then
		RayPart.Attachment1.WorldPosition = result.Position
		NormalPart.CFrame =, result.Position + result.Normal)
		RayPart.Attachment1.WorldPosition = RayPart.Position + (RayPart.CFrame.LookVector * MaxRayLength)
		NormalPart.CFrame =