Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

There's an infinite yield on WaitForChild("Animation")?

Asked by 6 years ago

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")'

Answer this question