So whenever i press E or Q it does not even fire the animation I tried it with Q by its self It worked perfectly fine but isn't working now.
-- Local Script --
local player = game.Players.LocalPlayer
repeat wait() until player.Character.Humanoid
local humanoid = player.Character.Humanoid
local mouse = player:GetMouse()
local replicatedStorage = game:GetService("ReplicatedStorage")
local AnimationFolder = replicatedStorage.AnimationEvents
local UIS = game:GetService("UserInputService")
local LeftPunchAnimation = script.LeftPunch
local RightPunchAnimation = script.RightPunch
local function Punch(key, gamepro)
if key.KeyCode == Enum.KeyCode.Q then
AnimationFolder.Punches:FireServer("Left")
elseif key.KeyCode == Enum.KeyCode.E then
AnimationFolder.Punches:FireServer("Right")
end
end
UIS.InputBegan:Connect(Punch)
-- Normal Script --
math.randomseed(tick())
local debounce = true
local replicatedStorage = game.ReplicatedStorage
local punchevent = replicatedStorage.AnimationEvents.Punches
local leftpunchanimation = (2945840423)
local rightpunchanimation = (02946022818)
local function onLeftPunchFired(player,Check)
if debounce then
debounce = false
if Check == "Left" then
local character = workspace:FindFirstChild(player.Name)
local humanoid = character.Humanoid
local leftanimation = Instance.new("Animation")
leftanimation.AnimationId = "https://roblox.com/asset/?id="..leftpunchanimation
local animTrack = humanoid:LoadAnimation(leftanimation)
animTrack:Play()
wait(1)
debounce = true
end
end
end
local function onRightPunchFired(player,Check)
if debounce then
debounce = false
if Check == "Right" then
local character = workspace:FindFirstChild(player.Name)
local humanoid = character.Humanoid
local rightanimation = Instance.new("Animation")
rightanimation.AnimationId = "https://roblox.com/asset/?id="..rightpunchanimation
local animTrack = humanoid:LoadAnimation(rightanimation)
animTrack.Play()
wait(1)
debounce = true
end
end
end
punchevent.OnServerEvent:Connect(onRightPunchFired)
punchevent.OnServerEvent:Connect(onLeftPunchFired)
