I am creating a gun script and creates a bullet trail using Ray when you shoot. Everything is fine when I shoot the ignored part in first person. The trail shoots straight and towards the direction where the mouse is pointing to. When I shoot through the ignored part in third person, the trail is a step higher above where the mouse is pointing to.
Gif: https://gyazo.com/92095dbe47007941f7668f94154d10b8
local Ray = Ray.new(MainPart.Position, (CFrame.new(MainPart.Position, Mouse.Hit.p) * Spread).lookVector.unit * ShootSettings.Range)
Hit, Pos = workspace:FindPartOnRayWithIgnoreList(Ray, Ray_Ignore)
Create bullet trail:
local distance = (MainPart.CFrame.p - Pos).magnitude
if TrailSettings.Enabled then
for _ = 1, ShootSettings.bulletAmount do
local Trail = Instance.new("Part")
Trail.Parent = Ignore_Model
Trail.BrickColor = BrickColor.new(TrailSettings.Color)
Trail.Material = TrailSettings.Material
Trail.Name = "bullet trail"
Trail.Transparency = TrailSettings.Transparency
Trail.Anchored = true
Trail.CanCollide = false
Trail.Size = Vector3.new(0.1, 0.1, distance)
t = Trail
for i = 0,distance,6 do
Trail.CFrame = CFrame.new(MainPart.CFrame.p, Pos) * CFrame.new(0,0,-distance / 2)
end
end
end

2 comments
).
Weird