Hello! I am wondering how to set a mouse's position in-game. This is what I made but the output prints "- can't set value". Please help!

local tool = script.Parent

tool.Equipped:connect(function(mouse)
	mouse.Button1Down:connect(function()
		mouse.Y = mouse.Y + math.random(3, 7)
		mouse.X = mouse.X + math.random(2, 4)
	end
end

4 comments

0

Its a local script or no?

0

yes

1

You cannot change the mouse position for security reasons

0

^ You can however force the players mouse into the center with UserInputService.MouseBehavior = "LockCenter" | and then point their camera to where you want it to look at exactly. this obviously wont work for anything UI related, but it's how you for example would make an aimbot.