Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Is there a way to make a GUI to fire a keycode?

I know this sounds confusing, but basically I want to make a button (specifically for mobile users) to fire a keycode. For example, a reload button, if I press the button it will fire the "R" keycode. I don't think there is a way, but if there is please answer. Thanks.

1 answer

You can do it in this way, using VirtualUser service:

gui.MouseButton1Click:Connect(function()
	local VS = game:GetService("VirtualUser")
    VS:CaptureController()
    VS:TypeKey("key_you_wanna_press") -- for example -  VS:TypeKey("e")
end)

I am not sure if it will work, but I think it should. Give it a try :).

3 comments

0

Will try thanks for helping.

0

No problem.

0

Did not work, errors with the current identity (2) cannot CaptureController (missing permission 3)

This discussion is preserved as it was. New answers, comments, and votes are closed.