Greetings Dev Forum. I have a rather simple issue with my punching script. I want to utilize an additional punch animation for the left arm which plays after the right arm punch animation. Any help is appreciated!
--//This is in StarterCharacterScripts
local UserInputService = game:GetService("UserInputService")
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local Root = character:WaitForChild("HumanoidRootPart")
local Animation = character:WaitForChild("Humanoid"):LoadAnimation(script:WaitForChild("Animation"))
--// Settings
--//local Keybind = UserInputType.MouseBot
local Damage = 5
local Debounce = 0.1
local Keybind = Enum.KeyCode.F
local CanPunch = true
UserInputService.InputBegan:Connect(function(input,busy)
if input.KeyCode == Keybind and not busy then
if CanPunch == true then
CanPunch = false
Animation:Play()
Animation.Looped = false
game.ReplicatedStorage.Remote.Punch:FireServer(Damage)
wait(Debounce)
CanPunch = true
end
end
end)
--// This is in ServerScriptService
game.ReplicatedStorage.Remote.Punch.OnServerEvent:Connect(function(player, damage)
for i,target in pairs(game.Workspace:GetDescendants()) do
if target.Name ~= player.Name then
if(target.Character.HumanoidRootPart.Position - player.Character.HumanoidRootPart.Position).magnitude < 5 then
target.Character.Humanoid.Health -= damage
end
end
end
end)
--// ~= is not equal to