Enabling and disabling virtual cursor

I’m working on a game where I would like to control when and where the new virtual cursor is enabled. Is there any way I can change that in game?

1 Like

If you are trying to change the icon of the mouse, you can do this:

local mouse = game.Players.LocalPlayer:GetMouse()
mouse.Icon = "http://www.roblox.com/asset?id=123456789"

So you can do this if you want the icon to be changed when something happens

local mouse = game.Players.LocalPlayer:GetMouse()

part.Touched:Connect(function()
   mouse.Icon = "http://www.roblox.com/asset?id=987654321"
end)

part2.Touched:Connect(function()
   mouse.Icon = "http://www.roblox.com/asset?id=999999999"
end)

Or you can do this

local mouse = game.Players.LocalPlayer:GetMouse()

while true do
   wait()

   if frame.Visible == true then
      mouse.Icon = "http://www.roblox.com/asset?id=999999999"
   elseif frame.Visible == false then
      mouse.Icon = "http://www.roblox.com/asset?id=111111111"
   end
end

Of course, these are just examples. You need to change the code to make it do what you want to happen. Also I haven’t tested this out so I’m not sure if some of these work. Anyways, here is a link for you to check out: Mouse | Roblox Creator Documentation

1 Like

I’ve done a bit of research and found out that this is not possible (yet). On the Developer Hub it says that this property is not scriptable, so you won’t be able to change it during run time.
https://developer.roblox.com/en-us/api-reference/property/StarterGui/VirtualCursorMode
However, if this was scriptable (or it becomes scriptable in the future), you would do it like this:


local StarterGui = game:GetService("StarterGui")

StarterGui.VirtualCursorMode = Enum.VirtualCursorMode.Disabled
2 Likes

Heya! this doesn’t works for me.

VirtualCursorMode is not a valid member of StarterGui “StarterGui”

I used ur localscript.