ServerScriptService.Script:10: invalid argument #1 to 'lookAt' (Vector3 expected, got Instance)

output:ServerScriptService.Script:10: invalid argument #1 to ‘lookAt’ (Vector3 expected, got Instance)
what i want: the ball goes to where your mouse it as

script:

local rep = game:GetService("ReplicatedStorage")
local rem = rep:WaitForChild("RemoteEvent")
local storage = game:GetService("ServerStorage")
local clone = storage:WaitForChild("Part"):clone()
local speed = 10
rem.OnServerEvent:Connect(function(plr,MouseHit)
	local char = plr.Character or plr.CharacterAdded:Wait()
	local humrp = char:WaitForChild("HumanoidRootPart")
	local bv = Instance.new("BodyVelocity")	
	clone.CFrame = CFrame.lookAt(humrp,MouseHit)
	bv.Velocity = clone.CFrame.lookVector * speed
	bv.Parent = clone
   clone.Parent = game.Workspace
end)

local script:

local  rep = game:GetService("ReplicatedStorage")
local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local rem = rep:WaitForChild("RemoteEvent")
local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(input,istyping)
	if istyping then return end
	if input.KeyCode == Enum.KeyCode.E then
		rem:FireServer(mouse.Hit.p)
	end
end)

Should be humrp.Position, not humrp

1 Like

how do i make the ball infront of my humrp?

You can multiply a CFrame by another CFrame to offset the CFrame relative to that first CFrame so something like

humanoidRootPart.CFrame * CFrame.new(0,0,10)

Might have to switch the X and Z axes, can never remember which one’s right.

1 Like

For it to be infront of the player’s character’s root it should be a negative transition along the Z-axis.

* CFrame.new(0, 0, -10)

A character’s LookVector describes a negative direction.