-
What do you want to achieve?
trying to make laser attachment for my weapon -
What is the issue?
it dosnt work -
What solutions have you tried so far?
asking my friend and google
local NormalPart = script.Parent.Parent.NormalPart
local RayPart = script.Parent
local MaxRayLenght = 100
local RayPrms = RaycastParams.new()
RayPrms.FilterType = Enum.RaycastFilterType.Blacklist
RayPrms.FilterDescendantsInstances = {RayPart, NormalPart}
RayPrms.IgnoreWater = true
while wait() do
local result = workspace:Raycast(RayPart.Position, RayPart.CFrame.LookVector * MaxRayLenght, RayPrms)
if result then
RayPart.Attachment1.WorldPosition = result.Position
NormalPart.CFrame = CFrame.new(result.Position, result.Position + result.Normal)
else
RayPart.Attachment1.WorldPosition = RayPart.Position + (RayPart.CFrame.LookVector * MaxRayLenght)
NormalPart.CFrame = CFrame.new(RayPart.Attachment1.WorldPosition)
end
end
how the framework work is by cloning the viewmodel from the replicated storage to player camera when equipped tool.how the attachment sytem work by clone the attachment from replicated storage to the Camera.Arms