Best way to approach bullet tracers?

Currently learning with beams but unsure on how to implement it into my code or on how to even set it up

local Gunpart = script.Parent
local MuzzleVelocity = 710
local bulletPos = Gunpart.Position
local bulletVelocity = Gunpart.CFrame.LookVector*MuzzleVelocity
local RunS = game:GetService("RunService")

local function fireBullet()
	local dt = RunS.Stepped:Wait()
	local RayStepped
	
	RayStepped = RunS.Stepped:Connect(function()
		
		local intersectionpoint = bulletPos + bulletVelocity/2
		
		local bulletCast = workspace:Raycast(bulletPos, bulletVelocity)
		
		bulletVelocity = bulletVelocity - (Vector3.new(0, workspace.Gravity, 0) * dt)
		bulletPos = bulletPos + bulletVelocity * dt
		
		local function tracereffect()
			local A0 = Gunpart.TracerA0
			local A1 = Gunpart.TracerA1
			local tracer = Gunpart.TracerBeam
			
			A0.Position = bulletVelocity
			A1.Position = bulletPos
			
		end
		
		if bulletCast then
			local Landedpart = Instance.new("Part")
			Landedpart.Parent = workspace
			Landedpart.Anchored = true
			Landedpart.Position = bulletCast.Position
			Landedpart.Size = Vector3.new(10, 10, 10)
			Landedpart.Material = Enum.Material.Neon
			Landedpart.BrickColor = BrickColor.new("Bright red")
			
			RayStepped:Disconnect()
		else
			bulletPos = bulletPos + bulletVelocity
			
		end
		
		if bulletVelocity.Magnitude >= 750 then
			RayStepped:Disconnect()
			print("stopped")
		end
		tracereffect()
	end)
end

fireBullet()

Been using this block of code for tracers, with my understanding that every time the raycast updates the position of the attachments also update but I feel like this maybe the wrong approach

		local function tracereffect()
			local A0 = Gunpart.TracerA0
			local A1 = Gunpart.TracerA1
			local tracer = Gunpart.TracerBeam
			
			A0.Position = bulletVelocity
			A1.Position = bulletPos
			
		end

Srry for bad english, lmk if topic is in wrong place or needs correction

Bumping, still stuck on coding tracers

maybe just use a trail to do this instead of beams?
do you mean something like in this game

1 Like

Thats awesome, but no
Looking to replicate Phantom force’s and FE kit tracer effects but on a much simpler scale
The trails in Crazy Stuff look great but look off putting since the tracers lack the spherical shape in many other gunkits and FPS games

I’d like to understand the code behind your tracers though, might be what I need for my project lol

nvm got it figured out :slight_smile: