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

Im trying to make a gun to my game, but then i started getting this error : (error down there)?

Asked by 6 years ago

the error is here cuz it wouldn't fit up there XD error : Players.mewant_taco.Backpack.Pistola.CódigoPrincipal:18: bad argument #3 to 'Size' (Vector3 expected, got number)

this is the code i made (some of the thing are in portuguese XD)

01local pistola = script.Parent
02-- Lista de Valores --
03local ammo = 12
04local maxAmmo = 64
05local damage = 20
06local headshotDamage = 50
07local range = 100
08local coolDown = 1.5
09 
10-- Som de Disparar --
11pistola.Activated:Connect(function()
12    pistola.Handle.Disparo:Play()
13end)
14 
15--Dsiparar a bala--
16pistola.Activated:Connect(function()
17    local bullet = Instance.new("Part")
18    bullet.Size = range,0.52,0.52
19    bullet.Position = game.StarterPack.Pistola.Hole.Position
20end)

Pls help me solving this thing.

0
bullet.Size = Vector3.new(range,0.52,0.52) User#20279 0 — 6y
0
it didn't worked, the error is gone but the bullet isn't appearing mewant_taco 17 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Ok so, Denny9876 said i need to use a Vector3 and that's what i did, and the error is gone, but now the bullet wont appear. Here's the new code:

01local pistola = script.Parent
02local hole = game.StarterPack.Pistola.Hole
03 
04-- Lista de Valores --
05local ammo = 12
06local maxAmmo = 64
07local damage = 20
08local headshotDamage = 50
09local range = 100
10local coolDown = 1.5
11 
12-- impedir spamming --
13local spam = false
14 
15-- Disparo --
View all 27 lines...

Pls help me fixing this.

0
Also thank you Denny9876 for helpping fix the error mewant_taco 17 — 6y
Ad

Answer this question