Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

ERROR: attempt to perform arithmetic (add) on nil and Vector3?

target.PrimaryPart=target.HumanoidRootPart
target:SetPrimaryPartCFrame(
CFrame.new(pos,pos+target.HumanoidRootPart.CFrame.lookVector))

What is wrong with these lines of code that would give me this error message? (the title)

3 comments

0

By the way target is the player's character

0

Can you show the script

0

because it’s hard to solve if you just show us one line.

1 answer

✓ Accepted answer

the error says your trying to add nil to a vector3 and the vector3 is

target.HumanoidRootPart.CFrame.lookVector

so it means pos does not exist

This discussion is preserved as it was. New answers, comments, and votes are closed.