local plr = game.Players.LocalPlayer local char = plr.Character local hum = char.Humanoid hum.Running:connect(function(speed) if speed > 0 then print(" I'm walking ") else print("I stopped walking") end end)
How can I make this print once? So when he starts walking it only prints it once? and not repeatly and infinitely? And when he stops he only prints the "I stopped walking" once?
This is simple I included debouncers and alot more aswell.
local plr = game.Players.LocalPlayer local char = plr.Character local hum = char.Humanoid local prin = true local deb = true hum.Running:connect(function(speed) if speed > 0 then if prin and deb then deb, prin = false print("Walken") wait(0.2) deb = true end elseif not prin and deb then deb, prin = false, true print("Stopped") wait(0.2) deb = true end end)
I think it isn't possible. Maybe use debounce?
local plr = game.Players.LocalPlayer local char = plr.Character local hum = char.Humanoid local print = false hum.Running:connect(function(speed) if speed > 0 then if not print then print = true print(" I'm walking ") else print("I stopped walking") print= false end end)
This is a situation where debounce comes in hand. It's intended for situations like this where the output is flooded with spam.
For more information, refer here.