local p = game.Players.LocalPlayer
local m = p:GetMouse()


m.Button1Down:Connect(function()
	local BP = Instance.new("BodyPosition", m.Target)
	BP.MaxForce = Vector3.new(math.huge, math.huge, math.huge)
	m.Move:Connect(function()
		print(m.Hit.p.X )
	BP.Position = Vector3.new((m.Hit.p.X - p.Character.HumanoidRootPart.Position.X).Unit*20, m.Hit.p.Y, (m.Hit.p.Z - p.Character.HumanoidRootPart.Position.Z).Unit*20)-- error!
	
	end)
end)

Error:

23:44:27.741 - Players.goodadmins.PlayerGui.LocalScript:10: attempt to index a number value
23:44:27.741 - Stack Begin
23:44:27.742 - Script 'Players.goodadmins.PlayerGui.LocalScript', Line 10
23:44:27.742 - Stack End

2 comments

0

Space out the math in line 10 so we can get a better idea on where the error is

0

Meaning make one math calculation per line, then put them all together