here is my script:
local runService game:GetService("RunService") local contextActionService = game:GetService("ContextActionService") local connection = nil
local function FlyAction(actionName, inputState, inputObject) if inputState ~= Enum.UserInputState.Begin then return Enum.ContextActionResult.Pass end if connection == nil then connection = runService.HeartBeat:Connect(function(deltaTime) <- error print("HB") end) else connection:Disconnect() connection = nil end end
contextActionService:BindAction("Fly", FlyAction, true, Enum.KeyCode.LeftShift) contextActionService:SetTitle("Fly", "Fly") contextActionService:SetPosition("Fly", UDim2.new(1, -150, 1, 08))