EDIT: I've fixed the bullet moving, but the position doesn't change whatsoever.

I'm attempting to create a gun that will shoot forwards, the bullet doesn't have any of the correct properties applied to it and only appears in one spot. Here's the script that creates the bullet and is meant to shoot it:

game.ReplicatedStorage.GunFire.OnServerEvent:Connect(function(P	layer,FireEvent,BulletTime,BulletSpeed)
	local Bullet = Instance.new("MeshPart")
	Bullet.Size = Vector3.new(1.204, 1.07, 1.08)
	Bullet.Material = Enum.Material.Neon
	Bullet.BrickColor = BrickColor.new("New Yeller")
	Bullet.Position = Vector3.new(FireEvent.Position)
	Bullet.Parent = FireEvent
	Bullet.CanCollide = false
	local Thrust = Instance.new("BodyThrust",Bullet)
	Thrust.Force = FireEvent.CFrame.LookVector * BulletSpeed
	delay(BulletTime,function()
		Bullet:Destroy()
	end)
end)

Note: "FireEvent" is the part the bullet comes out of. The bullet's parent is set to this, though it appears in one area.

"BulletTime" is merely the amount of time the bullet takes to disappear

"BulletSpeed" is the property that changes the force given to the BodyThrust.

2 comments

0

Why not raycast?

0

I don't want the bullet to shoot towards the mouse, and I wanted the bullet to be a fixed size for added realism.