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
10 years ago

Here is the script:

function fire(v)
    local vCharacter=Tool.Parent
    local vPlayer = game.Players:playerFromCharacter(vCharacter)
    local shield = Instance.new("Part")
    local spawnPos = vCharacter.PrimaryPart.Position
    spawnPos  = spawnPos + (v)


    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