I tried making a cooldown with debounce but when i use the move i cant use it again after the cooldown time passed
local player = game.Players.LocalPlayer local service = game:GetService("UserInputService") local sound = Instance.new("Sound") local rp = game:GetService("ReplicatedStorage") local Texas = rp:WaitForChild("Texas") local debounce = false local cooldown = 10
sound.SoundId = "rbxassetid://3545356912" sound.Parent = script.Parent sound.Volume = 0.3
service.InputBegan:Connect(function(input, isTyping) if isTyping then return elseif input.KeyCode == Enum.KeyCode.E then if debounce == false then debounce = true
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://7491517614"
sound:Play()
player.Character.Humanoid:LoadAnimation(anim) :Play()
wait(0.2)
local HumanRoot = player.Character.HumanoidRootPart
script.SmashEvent:FireServer(HumanRoot)
Texas:FireServer()
end
end
end)
Texas.OnClientEvent:Connect(function() wait(cooldown) debounce = false end)`

1 comment
the brackets after connect are just information that is passed into the other script - it doesnt run the code in the brackets * just a thing to add!