How would I kill something with a part I created?

Im making a gun and it creates a part were you click, how would I make that part kill something?

script.Parent.Main.Shoot.OnServerEvent:Connect(function(player, mousePos)
	local bullet = Instance.new("Part")
	bullet.Shape = "Ball"
	bullet.Size = Vector3.new(0.4,0.4,0.4)
	bullet.Parent = game.Workspace
	bullet.Position = mousePos
	bullet.Anchored = true
	bullet.Transparency = 1
end)
1 Like

Have you decided on how you want the gun to work:

  • Projectile
    or
  • Hitscan

For projectile, use fastcast
For Hitscan use raycast

2 Likes

I know but I do-not know how to do that stuff and its difficult to find out how.

1 Like

Yes, but I need to know which one you want to use to help you

hitscan i guess (fjsafhjdksfhdjkfhdsjkfhdsjk)

Projectile will make the game more realistic, and fastcast is a very reliable and handy software for shooter games.

Projectile means the gun shoots physical bullets, while hitscan means the gun uses raycast.

:o real bullets? how? I mean I know it’s possible but isin’t that very hard?

I mean like actually have a part that flies from the gun. this is the link

1 Like

Yeah I know? That’s why I suggested it, and plus it doesn’t just need to be raycast for hitscan, but it is recommended. Intro to Raycasting Here is the old wiki page for it, and here is the docs for FastCast API fastcast