
Key RequiredUniversal

-- GUI
local player = game.Players.LocalPlayer
local gui = Instance.new("ScreenGui")
gui.Parent = game.CoreGui
local vim = game:GetService("VirtualInputManager")
-- desativar controles mobile
pcall(function()
game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule"):WaitForChild("ControlModule"):Disable()
end)
-- função pra segurar tecla
local function holdKey(key)
vim:SendKeyEvent(true,key,false,game)
end
local function releaseKey(key)
vim:SendKeyEvent(false,key,false,game)
end
-- criar botão
local function createButton(text,posX,posY,parent)
local b = Instance.new("TextButton")
b.Size = UDim2.new(0,60,0,60)
b.Position = UDim2.new(posX,0,posY,0)
b.Text = text
b.TextScaled = true
b.BackgroundColor3 = Color3.fromRGB(40,40,40)
b.TextColor3 = Color3.new(1,1,1)
b.Parent = parent
return b
end
-- BOTÕES ESQUERDA
local up = createButton("↑",0.05,0.7,gui)
local left = createButton("←",0.0,0.8,gui)
local right = createButton("→",0.1,0.8,gui)
local down = createButton("↓",0.05,0.9,gui)
-- função para botão segurável
local function makeHold(button,key)
button.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Touch then
holdKey(key)
end
end)
button.InputEnded:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Touch then
releaseKey(key)
end
end)
end
makeHold(up,Enum.KeyCode.W)
makeHold(left,Enum.KeyCode.A)
makeHold(right,Enum.KeyCode.D)
makeHold(down,Enum.KeyCode.S)
-- BOTÕES DIREITA
local q = createButton("Q",0.85,0.7,gui)
local t = createButton("T",0.75,0.8,gui)
local e = createButton("E",0.85,0.9,gui)
local function pressKey(key)
vim:SendKeyEvent(true,key,false,game)
task.wait(0.05)
vim:SendKeyEvent(false,key,false,game)
end
q.MouseButton1Click:Connect(function()
pressKey(Enum.KeyCode.Q)
end)
t.MouseButton1Click:Connect(function()
pressKey(Enum.KeyCode.T)
end)
e.MouseButton1Click:Connect(function()
pressKey(Enum.KeyCode.E)
end)No comments yet for this script.



