Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how to disconnect a heartbeat?

so this is what ive tried

local count = 0
local heartbeat = game:GetService("RunService").Heartbeat:Connect(function()
	if count >= 300 then
		heartbeat:Disconnect()
	end
	count = count + 1
end)

but is says that heartbeat is unknown help?

1 comment

0

what i want it to do is that i want it to go 300 times

1 answer

✓ Accepted answer
local heartbeat = game:GetService("RunService").Heartbeat:Connect(function()

Simply remove the "local"

heartbeat = game:GetService("RunService").Heartbeat:Connect(function()

2 comments

0

wow it worked at first i looked over this i thought u said take out the entire local heartbeat = good thing i realized that wasn't what you meant

0

hello

This discussion is preserved as it was. New answers, comments, and votes are closed.