How do I turn runservice.heartbeat on and off

Basically that. Also do I need to pass a parameter to it?

1 Like

U can put the event in a variable like local event = RunService.Heartbeat:Connect.... and then call event:Disconnect

2 Likes

Im not sure you understand RunService.Heartbeat is an event, no parameters need to be parsed to it nor does it need to be turned on or off

1 Like

I want to turn it on and off though because I want to put it in a vehicle script. Also on developer it shows a parameter, delta time. No clue where to pass from or how use that though. RunService.Heartbeat:Connect(function(step)

1 Like

Ah cool ty. Will the local event automatically start running or do I need to then put the local event into something?

1 Like

U will have to recreate the event again. So u can connect the local event = RunService.Heartbeat:Connect.... function to for example Seat:GetPropertyChanged(‘Occupant’) or something and then that event will start running again.

then when the player leaves the car, you can call event:Disconnect() and it will stop.

2 Likes