local RS = game:GetService("ReplicatedStorage") local Event = Instance.new("RemoteEvent", RS) Event.Name = "PunchEvent"
local function FiredEvent(Player) local Character = game.Workspace:WaitForChild(Player.Name) local Animation = RS:WaitForChild('Animation'):GetChildren()[math.random(1, #RS.Animation:GetChildren())] print(Animation) local RandomAnim = Character.Humanoid:LoadAnimation(Animation) RandomAnim:Play() local Damage = script.Damage:Clone() if Animation.Name == "Right Arm" then Damage.Parent = Character:WaitForChild("Right Arm") end Damage.Disabled = false wait(1.4) Damage:Destroy() end
Event.OnServerEvent:Connect(FiredEvent)
is the code but it says there's an infinite yield on 'ReplicatedStorage:WaitForChild("Animation")'