So I am trying to make a line between me and a part where my mouse is.It is ok until i move. If I move my the line keep getting offsetted, so I don't how to fix this.
local a = Instance.new("Part",player.Character.Torso)
a.CFrame = Char.HumanoidRootPart.CFrame*CFrame.new(0,-2.5,0)
a.Anchored = true
a.Transparency = 0
a.CanCollide = false
-----------------------------------
local b = Instance.new("Part",player.Character.Torso)
b.CFrame = CFrame.new(Mouse.Hit.p.X,Mouse.Hit.p.Y,Mouse.Hit.p.Z)
b.Anchored = true
b.Transparency = 0
b.CanCollide = false
local dist = (a.Position - b.Position).magnitude
-----------------------------------
local c = Instance.new("Part",player.Character.Torso)
c.CFrame = CFrame.new(a.Position + 0.5*(b.Position - a.Position))*CFrame.new(a.Position,b.Position)
c.Anchored = true
c.Transparency = 0
c.CanCollide = false
c.Size = Vector3.new(2,1,dist)
------------------------------
game.Debris:AddItem(a, 3)
game.Debris:AddItem(b, 3)
game.Debris:AddItem(c, 3)
