Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i update the position of my mouse using mouse.Hit.p?(SOLVED)

Asked by 5 years ago
Edited 5 years ago

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)
0
What? Robloxian_Hero1234 14 — 5y
0
You're printing "mousePos", but I don't see a variable for it anywhere. Where is it and how do you update it? User#20279 0 — 5y
0
oh sry forgot to unclude the variable: mousePos = mouse.Hit.p paperking12 20 — 5y
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. User#20279 0 — 5y
0
thx it works now paperking12 20 — 5y

Answer this question