Right now, every thing works so far but for some reason, BasePart:Resize isn’t scaling in one axis.
RunService.Heartbeat:Connect(function()
local leftRayOrigin = leftLazerEyeBone.WorldPosition
local rightRayOrigin = rightLazerEyeBone.WorldPosition
local leftDirection = (target.Position - leftRayOrigin).Unit
local rightDirection = (target.Position - rightRayOrigin).Unit
local leftRaycastResult = workspace:Raycast(leftRayOrigin, leftDirection * raycastLazerEyesMaxRange)
local rightRaycastResult = workspace:Raycast(rightRayOrigin, rightDirection * raycastLazerEyesMaxRange)
local leftCenter = (leftRayOrigin + target.Position) / 2
local rightCenter = (rightRayOrigin + target.Position) / 2
if leftRaycastResult then
local distance = leftRaycastResult.Distance
leftLazer:Resize(Enum.NormalId.Front, distance)
leftLazer.Position = leftCenter
leftLazer.CFrame = CFrame.lookAt(leftRayOrigin, target.Position)
else
leftLazer:Resize(Enum.NormalId.Front, raycastLazerEyesMaxRange)
leftLazer.Position = leftCenter
leftLazer.CFrame = CFrame.lookAt(leftRayOrigin, target.Position)
end
if rightRaycastResult then
local distance = rightRaycastResult.Distance
rightLazer:Resize(Enum.NormalId.Front, distance)
rightLazer.Position = rightCenter
rightLazer.CFrame = CFrame.lookAt(rightRayOrigin, target.Position)
else
rightLazer:Resize(Enum.NormalId.Front, raycastLazerEyesMaxRange)
rightLazer.Position = rightCenter
rightLazer.CFrame = CFrame.lookAt(rightRayOrigin, target.Position)
end
end)
Another problem is that it resizes way to long.