VirtualUserService Help

I want to learn about the VirtualUserService but there are no tutorials on YT or examples in the API reference. Does anybody know an article or know it themselves?(Even though it may be obsolete.)

Thanks.

2 Likes

Don’t watch YouTube, here’s a link: VirtualUser | Documentation - Roblox Creator Hub

Honestly anything, even YT would be good. The link you sent I’ve already viewed. There aren’t any examples. Does anybody know how to use it?

It would help if you explained what you wanted to achieve?

I want to know how to use the TypeKey() function of it.

Looking at the documentation:

local virtual = game:GetService('VirtualUser')
virtual:CaptureController()
virtual:MoveMouse(Vector2.new(50, 50), game.Workspace.CurrentCamera.CFrame)
virtual:TypeKey('e')

However, you wouldn’t be able to use this in a LocalScript to work on a client - it would only work when you have a permission level of 3 e.g. in a plugin/command bar

Similarly, to use the recording service:

local RECORDING_TIME = 2 -- seconds
local virtual = game:GetService('VirtualUser')
virtual:StartRecording()
delay(RECORDING_TIME, function ()
	local data = virtual:StopRecording()
	print(data)
end)

After testing this in studio via the command bar, I’d like to note that only the latter code actually functions as intended. The methods to capture hardware and to initiate input don’t seem to work.

1 Like