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

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

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

✓ Accepted answer

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)

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