Here's the problem: When using game:GetService('ContextActionService')
to make mobile controls for my game, I use a debounce called Allowed
. It controls whether the buttons should be active or not. I tried to use this code to make it happen:
local CAS = game:GetService('ContextActionService') while true do if Allowed then CAS:BindAction('function', predefinedfunction, true, Enum.KeyCode.Z) end end
The code seemed fine to me, until I tested it. Immediately after Allowed
was set to true, It spammed the function it was binded to. I can't seem to figure out why.
Please help.