I want to make this code script cooldown because if it not cooldown it's gonna spam pose and if I put sound in it it's gonna spam sound
01 | local UIS = game:GetService( "UserInputService" ) |
02 | local plr = game.Players.LocalPlayer |
03 | local char = plr.Character or plr.CharacterAdded:Wait() |
04 |
05 |
06 | local key = 'F' |
07 |
08 | local Taunt = Instance.new( "Animation" ) |
09 | Taunt.AnimationId = 'rbxassetid://3616396884' -- other animations 2262820217, 2262813409, 2425154387, |
10 | local taunted = false |
11 |
12 | UIS.InputBegan:Connect( function (Input, IsTyping) |
13 | if IsTyping then return end |
14 | local KeyPressed = Input.KeyCode |
15 | if KeyPressed = = Enum.KeyCode [ key ] then |
It seems like you already almost have a debounce. Simply add if taunted then return end
to the script, like this:
01 | local UIS = game:GetService( "UserInputService" ) |
02 | local plr = game.Players.LocalPlayer |
03 | local char = plr.Character or plr.CharacterAdded:Wait() |
04 |
05 |
06 | local key = 'F' |
07 |
08 | local Taunt = Instance.new( "Animation" ) |
09 | Taunt.AnimationId = 'rbxassetid://3616396884' -- other animations 2262820217, 2262813409, 2425154387, |
10 | local taunted = false |
11 |
12 | UIS.InputBegan:Connect( function (Input, IsTyping) |
13 | if taunted then return end |
14 | if IsTyping then return end |
15 | local KeyPressed = Input.KeyCode |
If my answer solved your problem please don't forget to upvote and accept it. Thanks!