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

Why is this script erroring? (Vector3 expected, got nil)

Asked by
mruno 20
11 years ago

Here is the script:

1function fire(v)
2    local vCharacter=Tool.Parent
3    local vPlayer = game.Players:playerFromCharacter(vCharacter)
4    local shield = Instance.new("Part")
5    local spawnPos = vCharacter.PrimaryPart.Position
6    spawnPos  = spawnPos + (v)
7 
8 
9    shield.Position=spawnpos

When I click with the tool in play solo, I get this error: bad argument #3 to 'Position' (Vector3 expected, got nil)

I can't work out what is causing this, because I have used the same piece of code in other tools and it has worked

Answer this question