Ad
Log in to vote
0

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", UDim2.new(1, -150, 1, 08))

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

Answer this question