Help with understanding this error

  1. What do you want to achieve? I want to understand what this error means and how I can fix it

  2. What is the issue? here’s the error: Workspace.hopeshusbvnd.Hydrokinesis:48: invalid argument #2 to 'new' (Vector3 expected, got Instance)

  3. What solutions have you tried so far? I’ve tried checking devHub but it didn’t have a solution to what I needed

here’s the part where it errors:

UIS.InputEnded:Connect(function(input, gameprocessed)
	if input.KeyCode == Enum.KeyCode.Q then
		qPressed = false
		
		bv:Destroy()
		local moveVelocity = Instance.new("BodyVelocity", waterBall)
		bv.Velocity = CFrame.new(waterBall.Position, mouse).LookVector * 100
		
		waterBall.Touched:Connect(function(Touched)
			if Touched:isDescendantOf(character) then return end
			
			splash.Position = waterBall.Position
			waterBall:Destroy()
			splash.Parent = workspace
		end)
	end
end)

all help is appreciated

1 Like

what does mouse = ?

mouse is the player’s mouse

(char limit)

game.Players.LocalPlayer:GetMouse() is a mouse Instance, which is why you got an error “Vector3 expected got Instance”

https://developer.roblox.com/en-us/api-reference/class/Mouse

You can use Mouse.Hit.Position which is a Vector3

I did it but it just moved up, not towards the mouse

You didn’t tell me what you are trying to accomplish you just asked why it errored, I told you why it errored.

If you are telling me you want “it to move towards the mouse”, I don’t really know what that means. You want something to move toward where the mouse hits? You want something to move toward the mouse’s origin on the screen? You want something to move toward the mouse’s 2d position?

Sorry about that! I realized my mistake, thank you for helping me out :slight_smile:

1 Like