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

keeps erroring attempt to multiply a Vector3 with an incompatible value type or nil?

Asked by 5 years ago

This is all done in a local script but it keeps erroring saying Tool = script.Parent

18:01:04.169 - attempt to multiply a Vector3 with an incompatible value type or nil

Tool = script.Parent
Tool.Activated:Connect(function()
    print(UpTorso)
    Ball = Instance.new("Part") Ball.Shape = 'Ball' Ball.BrickColor = BrickColor.new("Reddish brown") Ball.Parent = game.Workspace game.Debris:AddItem(Ball,5)
    BF = Instance.new("BodyForce") BF.Parent = Ball 
    Ball.Position = UpTorso.Position * CFrame.new(0,1,0)
    BF.Force = Vector3.new(600,600,0)
    game.Debris:AddItem(BF,1)
end)


Tool.Equipped:Connect(function()
    UpTorso = Tool.Parent:FindFirstChild('Head')


end)

1 answer

Log in to vote
1
Answered by 5 years ago

This is because Vector3 and CFrame (CoordinateFrame) are two different things, and therefore you cannot use them with each other.

You have two options for your case:

1) Get the CFrame's position by adding .p to get the position from the CFrame

Ball.Position = UpTorso.Position * CFrame.new(0,1,0).p -- Note the ".p" at the end

2) Use Vector3.new instead of CFrame.new.

Ball.Position = UpTorso.Position * Vector3.new(0,1,0)
Ad

Answer this question