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

What is the problem with my gun firing script? (New problem found...)

Asked by 10 years ago
01local damage = 50
02local auto = true
03local mags = 8
04tool = script.Parent
05handle = tool.Handle
06keys = {"q", "e"}
07local cam = workspace.CurrentCamera
08local barral = tool.Barrel
09local bullets = tool.rounds.Value
10function shots()
11    repeat
12        wait (0.2)
13    local bullet = Instance.new("Part")
14    bullet.Name = "Bullet"
15    bullet.CFrame = CFrame.new(barral.CFrame)
View all 41 lines...

so i got help on that, but now, the output says: 14:19:33.240 - Players.Player1.Backpack.turret.LocalScript:16: bad argument #1 to 'new' (Vector3 expected, got userdata) 14:19:33.244 - Script 'Players.Player1.Backpack.turret.LocalScript', Line 16 14:19:33.247 - Stack End

1 answer

Log in to vote
0
Answered by
Nymint 85
10 years ago
1--Line 25
2bullet.Hit:connect(function(hit) end) --(No.)
3bullet.Touched:connect(function(hit) end) --(Yes.)
4-- BUT. You have a problem here, you're using a local variable that is INSIDE a function called shots()
5--If you make a local variable and try to call it outside of the area you just created it, it won't do the job. just move the .Touched event function inside shots()
6--And, Line 26
7Brick.FindFirstChild --(No.)
8Brick:FindFirstChild --(Yes.)

You can just use "Workspace" now, instead of game.Workspace. I suggest you to learn about WaitForChild.

0
Thank you, i usually catch the functions, im just trying to think of to many things at once, becuase im trying to make a huge update to my game, my friends skyping me, so those to things distract me easily right now... thank you. rollercoaster57 65 — 10y
0
Actually, its supposed to be that only an alien humanoid in my game is affected aswell. rollercoaster57 65 — 10y
0
That helped... but i have a new problem now. rollercoaster57 65 — 10y
0
What is it? Nymint 85 — 10y
0
its up there... rollercoaster57 65 — 10y
Ad

Answer this question