I’m creating a sniper and the bullet tracer is a Beam with attachments but it looks like you’re firing multiple bullets instead of just 1
Local Script:
local tool = script.Parent
local origin = tool.Origin
local re = tool.RemoteEvent
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
tool.Activated:Connect(function()
re:FireServer(mouse.Hit, origin.Attachment)
end)
Server Script:
local Debris = game:GetService("Debris")
local DURATION = 0.1
local re = script.Parent.RemoteEvent
re.OnServerEvent:Connect(function(player, hit, attachment0)
local distance = (attachment0.Position - hit.Position).Magnitude
local beam = workspace.Terrain.Beam:Clone()
local attachment1 = workspace.Terrain.Attachment:Clone()
attachment1.Position = hit.Position
attachment1.Parent = workspace.Terrain
beam.Attachment0 = attachment0
beam.Attachment1 = attachment1
beam.Parent = workspace
Debris:AddItem(beam, DURATION)
Debris:AddItem(attachment1, DURATION)
end)
Beam properties:
