I’ve been trying to make a simple part that acts as a tracer in my gun framework.
It doesn’t seem to set itself to the correct CFrame of the attachment, even though I’m 100% sure it should able to.
Let me explain quickly.
This is a module function I made that adds parts where origin is located:
function Caster:VisualizeRays(Origin, Result)
local Part = Instance.new("Part")
Part.Anchored = true
Part.CanCollide = false
Part.Material = Enum.Material.Neon
Part.Color = Color3.fromRGB(214, 124, 88)
Part.Parent = workspace.Terrain
Part.CFrame = Origin.WorldCFrame
end
Origin
in this code is supposed to be an attachment.
So, I used this function in a different module script, which has a variable that stores the attachment point from my viewmodel:
local Info = {
FirePoint = nil
}
function FireBullet()
local Bullet = Caster:FireCast(Camera.CFrame.Position, Camera.CFrame.LookVector)
Caster:VisualizeRays(Info.FirePoint, Bullet)
end
function Weapon:StartHandler(Viewmodel: string)
local Model = Camera:FindFirstChildOfClass("Model")
Data.Model = Model
task.wait(1)
Info.FirePoint = Data.Model.Handle.ParticlePoint
end
So everything seems to be in order right? the attachment is shown correctly here.
no. it doesnt even instance the part in the correct place.
I’ve been banging my head against a wall for a good while and still haven’t been able to fix it, i’d really appreciate your help here : (