i'm using mouse.Hit.p and whenever i press E on my keyboard and it starts to print the same thing over and over but won't update the position of my mouse. How can i fix this?

The Print:

-5.58721495, 0, 3.2968421 (x546)

Script:

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.E then
                mouse.Move:Connect(function()
		print(mousePos)
		end)
	end
end)

5 comments

0

What?

0

You're printing "mousePos", but I don't see a variable for it anywhere. Where is it and how do you update it?

0

oh sry forgot to unclude the variable: mousePos = mouse.Hit.p

0

Instead of doing "print(mousePos)", you could do "print(mouse.Hit.p)" to get the current position of the mouse. Or you can put "mousePos = mouse.Hit.p" inside the mouse.Move function so the variable will update.

0

thx it works now