PFS gun bullet system

So I’m currently working on a bullet script for my FPS gun but I’m running into some problems.

The way that I’m doing it now isn’t very smooth and doesn’t really look good.

code:

fireEvent.OnServerEvent:Connect(function(player, MousePosition, BulletPosition)
	-- create bullet
	local bullet = Instance.new("Part")
	bullet.Parent = game.Workspace
	bullet.CFrame = CFrame.new(BulletPosition, MousePosition)
	bullet.Size = Vector3.new(0.1, 0.1, 1)
	bullet.Material = Enum.Material.Neon
	bullet.CanCollide = false
	bullet.Position = BulletPosition
	bullet.BrickColor = BrickColor.new("Bright yellow")
	
	-- make bullet damage
	local damageScript = tool.System.Storage.DamageScript:Clone()
	damageScript.Parent = bullet
	
	-- shoot bullet
	local distance = (MousePosition - BulletPosition).Magnitude
	local speed = 500
	bullet.Velocity = bullet.CFrame.LookVector * speed
	Debris:AddItem(bullet, 0.5)
end)

game:
https://www.roblox.com/games/7198314980/gun-system-try-6

The way that I’m trying to make it look is like the bullets in phantom force, DEADLINE or Blackhawk 5 rescue mission.

So if it smoothness that you want, I suggest instead of using physical parts for bullets, I would use tracers/beams.

-I mostly use beams for my guns and it is way smoother since it is just a flash-

If your not familiar with this method you can use this for reference.
https://developer.roblox.com/en-us/api-reference/class/Beam

Can you maybe explain how to implement this.
I’m really confused about the concept because there has to be a lot to take account to like placement of attachment, knowing when the beam has played once, …

I’m trying to make the bullets have physics like in phantom force, DEADLINE or Blackhawk 5 rescue mission.

I’ve never played those games. Can you be specific what kind of physics?

when you shoot long distance, they lose height / go down. so If you’re a sniper and you try to shoot long distance you have to aim a bit more up then where the target really is.

Ok well then you would have to use a part. If your asking me, I suggest changing the transparency of the bullet to about 0.56, and changing the velocity to about 850 or so. Maybe also consider making the part a little bit skinnier and longer.

Also, you could add a semi - white / greyish trail to the object.

I tried changing the size and velocity but now for some reason the bullets won’t hit the player all the time.

.Velocity is deprecated as it says on the wiki. I recommend using a FastCast module, it’s good for making FPS systems.

References:

1 Like

thanks, I’m normally not a person that likes to copy scripts but I just tried this and it works really well.

1 Like

it is really complicated to make changes to though

1 Like