Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to make a gun fire like a shotgun?

Asked by
1Juice1 10
10 years ago

I'm trying to make a gun fire three different bullets in a fashion similar to a shotgun, but I can't figure it out. What should I do to this script to get it to work?

01local Tool = script.Parent
02 
03enabled = true
04 
05function fire(v)
06 
07    local vCharacter = Tool.Parent
08    local vPlayer = game.Players:playerFromCharacter(vCharacter)
09    local Torso = vCharacter.Torso
10    local spawnPos = Torso.Position
11    spawnPos = spawnPos + (v * 3)
12    for i = 1,3 do
13        local missile = Instance.new("Part")
14        missile.Position = spawnPos
15        missile.Size = Vector3.new(0.6,0.6,0.6)
View all 55 lines...

2 answers

Log in to vote
1
Answered by 10 years ago

Simple, Just make about 6 parts, set their position to math.random(10,0,-5)

You can also do math.random(player.mouse.p)

Ad
Log in to vote
-3
Answered by 10 years ago

I'll message you my gun script,It's to long to put in the Answers but here you go.

Answer this question