Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 1 year 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 2189 — 1y
0
i did FallenAngel_ii 7 — 1y

Answer this question