Part.Position is off?

  1. What do you want to achieve? Keep it simple and clear!
    I wanna create moving tracers that start from the barrel of the gun.
  2. What is the issue? Include screenshots / videos if possible!
    For some reason the barrel position is off.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I really have no idea how to fix this, because sometimes it just fixes itself and starts creating tracers from the barrel

Here is how it looks when its off

And here is how it should look like

Function that creates the tracers

function m.createTracer(origin: Vector3, target: Vector3, hitPart: BasePart, normal: Vector3)
	local bulletSpeed = 750
	local direction = (target - origin).Unit
	local distance = (target - origin).Magnitude
	local travelTime = distance / bulletSpeed

	local tracer = assets.Tracer:Clone()
	tracer.Position = origin
	tracer.Parent = workspace

	local goalPosition = origin + direction * distance
	local tweenInfo = TweenInfo.new(travelTime, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false, 0.015)
	local tween = tweenService:Create(tracer, tweenInfo, {Position = goalPosition})

	tween:Play()
	
	task.delay(travelTime, function()
		tracer.Trail.Enabled = false
		task.wait(1)
		tracer:Destroy()
	end)
end

i just pass the .Position property of the Barrel part for the origin.

I had an issue close to this some time ago, you could try using CFrame and then resetting the orientation, I know it might sound dumb, but it worked for me

This doesnt seem to work for me…

Apparently something was wrong with my viewmodel, remaking the viewmodel fixed this problem

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