https://gyazo.com/2d72010dd31b46ae69f101513bfb643f
Heres local script
local Player = game:GetService("Players") local rp = game:GetService("ReplicatedStorage") local Lancer = rp:WaitForChild("Lancer") local UIS = game:GetService("UserInputService") local debounce = false local cooldown = 1 UIS.InputBegan:Connect(function(input,isTyping) if isTyping then return elseif input.KeyCode == Enum.KeyCode.E and debounce == false then debounce = true Lancer:FireServer() end end) Lancer.OnClientEvent:Connect(function() wait(cooldown) debounce = false end)
And normal script
local rp = game:GetService("ReplicatedStorage") local Lancer = rp:WaitForChild("Lancer") local Animation = game.Workspace.Animations:WaitForChild("Swing") Lancer.OnServerEvent:Connect(function(Player) local Character = Player.Character local Humanoid = Character:FindFirstChild("Humanoid") local LoadedAnimation = Humanoid:LoadAnimation(Animation) LoadedAnimation:Play() end)
To reset the debounce, edit this in your server script:
local rp = game:GetService("ReplicatedStorage") local Lancer = rp:WaitForChild("Lancer") local Animation = AnimationFolderHere:WaitForChild("AnimationNameHere") -- Find the animation Lancer.OnServerEvent:Connect(function(Player) -- Listen to event fire local Character = Player.Character -- Get the player's character local Humanoid = Character:FindFirstChild("Humanoid") local LoadedAnimation = Humanoid:LoadAnimation(Animation) -- Load the animation LoadedAnimation:Play() -- Play the animation Lancer:FireClient(Player) end)
You are not firing the client once the animation has played, so the debounce never resets to false. Make sure to reset your debounce or else it will only work once.