local damage = 50 local auto = true local mags = 8 tool = script.Parent handle = tool.Handle keys = {"q", "e"} local cam = workspace.CurrentCamera local barral = tool.Barrel local bullets = tool.rounds.Value function shots() repeat wait (0.2) local bullet = Instance.new("Part") bullet.Name = "Bullet" bullet.CFrame = CFrame.new(barral.CFrame) bullet.Velocity = Vector3.new(100, 0, 0) bullet.Size = Vector3.new(0.5, 0.5, 1.5) bullets = bullets -1 bullet.Touched:connect(function(hit) local ALIEN = hit.Parent.FindFirstChild("alien") alien:TakeDamage(damage) end) if bullets == 0 then mags = mags -1 wait (5) end until mags == 0 end function onKeyDown(key) if key == "q"then cam.CameraSubject = tool.looksight cam.CameraType = custom elseif key == "e" then game.Workspace.CurrentCamera.CameraSubject = game.Players.LocalPlayer.Character.Humanoid game.Workspace.CurrentCamera.CameraType = "Custom" end end tool.Activated:connect(shots)
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
--Line 25 bullet.Hit:connect(function(hit) end) --(No.) bullet.Touched:connect(function(hit) end) --(Yes.) -- BUT. You have a problem here, you're using a local variable that is INSIDE a function called shots() --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() --And, Line 26 Brick.FindFirstChild --(No.) Brick:FindFirstChild --(Yes.)
You can just use "Workspace" now, instead of game.Workspace. I suggest you to learn about WaitForChild.