Hello! Is There A Way I Can Make A [SPAM KEYBIND] System?
Just Like This Vid:
(Ah, gross)
Anyways, it’s pretty simple, every time the button is pressed, add a certain percentage to the GUI and when it’s at 100% do something
[yeah sorry it was the only thing i could find]
also sure ill try it.
also do i just like make it wait 0.5 and then lower it if not spammed?
Depends, if you want it to wait then put it wait, but 0.5 is too much, as spamming doesn’t take taht much, I spammed this in 5 seconds (on phone):
Sssssssssssssssssss
I’ll flag this as spam (: -;6- anyways you could connect every time the player presses a key and add 1 to a value and if it’s the amount of times you want them to spam it then do whatever
kk what if i want it to lower if not spammed?
Then make a variable with task.spawn(function() and make it wait how long us want and subtract one. In your connection (when the player presses the key) use task.cancel(variable) hope this works!
kk thanks ill try it too [this text is here because the text limit is 30]
Also, make sure you do
local WaitTask = task.wait(function() end)
Assign the task to a variable so you are actually cancelling what you want.
I said that also you used the wrong task. You used wait instead of spawn
Oh yeah, mb. Didn’t notice. Lmao task.wait(funcion(). I’m so stupid.
It would work like this.
--EXPLOSION IS A NUMBER VALUE.
-- CLIENT
local UIS = game:GetService("UserInputService")
local Value = game:GetService("ReplicatedStorage").Explosion
local Function = game:GetService("ReplicatedStorage").RemoteFunction
DB = false
UIS.InputBegan:Connect(function(Input, GPE)
if not GPE then
if not DB then
if Value.Value <= 11 and Input.KeyCode == Enum.KeyCode.E then
DB = true
Function:InvokeServer()
task.wait(0.2)
DB = false
end
end
end
end)
---SERVER
local last = tick()
local Explosion = game:GetService("ReplicatedStorage").Explosion
game:GetService("ReplicatedStorage").RemoteFunction.OnServerInvoke = function(Player)
if game:GetService("ReplicatedStorage").Explosion.Value <= 10 then
game:GetService("ReplicatedStorage").Explosion.Value += 1
else
Player.Character.Head:Destroy() -- we kill player
end
end
Explosion.Changed:Connect(function(Value)
last = tick()
task.delay(0.4,function() -- player hasnt pressed E in 0.4 seconds, we start decreasing it.
if Explosion.Value == Value and Explosion.Value > 0 then
Explosion.Value -= 1
end
end)
end)
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.