Log in to vote

trying to script flight. error popping up "attempt to index nil with 'Heartbeat"?

Asked by 2 months ago

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",, -150, 1, 08))

you didnt put an = sign in runService T3_MasterGamer 1002 — 2mo
i did FallenAngel_ii 7 — 2mo

Answer this question