game.ReplicatedStorage.Selected.OnClientEvent:Connect(function(player , Clone)
if Player:FindFirstChild("Shield1") then
local Animations =Player:WaitForChild("Shield1"):FindFirstChild("Animations")
local Block = Character:WaitForChild("Humanoid"):LoadAnimation(Animations.Blocking)
local Punch3 = Character:WaitForChild("Humanoid"):LoadAnimation(Animations.Punch3)
local punch2 = Character:WaitForChild("Humanoid"):LoadAnimation(Animations.Punch2)
local EquipAnimation = Character:WaitForChild("Humanoid"):LoadAnimation(Animations.Equip)
local UnEquipAnimation = Character:WaitForChild("Humanoid"):LoadAnimation(Animations.Unequip)
local Punch1 = Character:WaitForChild("Humanoid"):LoadAnimation(Animations.punch1)
local Holding = Character:WaitForChild("Humanoid"):LoadAnimation(Animations.Holding)
elseif Player:FindFirstChild("Shield") then
local Animations = player.Character:FindFirstChild("Shield").Animations
local Block = Character:WaitForChild("Humanoid"):LoadAnimation(Animations.Blocking)
local Punch3 = Character:WaitForChild("Humanoid"):LoadAnimation(Animations.Punch3)
local punch2 = Character:WaitForChild("Humanoid"):LoadAnimation(Animations.Punch2)
local EquipAnimation = Character:WaitForChild("Humanoid"):LoadAnimation(Animations.Equip)
local UnEquipAnimation = Character:WaitForChild("Humanoid"):LoadAnimation(Animations.Unequip)
local Punch1 = Character:WaitForChild("Humanoid"):LoadAnimation(Animations.punch1)
local Holding = Character:WaitForChild("Humanoid"):LoadAnimation(Animations.Holding)
The rest of the script is where the animation is played
when the player press a key but it doesnât load for some reasons
also bot end and end) are down of the script so it can read the animations
My bad i forgot to mention that this is a client script and when the server script fires the client with the player who fired it the client will load the animation but it wonât load it for somereasons
I updated a part of the script here it is:
game.ReplicatedStorage.Selected.OnClientEvent:Connect(function(player , Clone)
local Animations =Player:WaitForChild("Shield1"):FindFirstChild("Animations") or Player:WaitForChild("Shield"):FindFirstChild("Animations")
local Block = Character:WaitForChild("Humanoid").Animator:LoadAnimation(Animations.Blocking)
local Punch3 = Character:WaitForChild("Humanoid").Animator:LoadAnimation(Animations.Punch3)
local punch2 = Character:WaitForChild("Humanoid").Animator:LoadAnimation(Animations.Punch2)
local EquipAnimation = Character:WaitForChild("Humanoid").Animator:LoadAnimation(Animations.Equip)
local UnEquipAnimation = Character:WaitForChild("Humanoid").Animator:LoadAnimation(Animations.Unequip)
local Punch1 = Character:WaitForChild("Humanoid").Animator:LoadAnimation(Animations.punch1)
local Holding = Character:WaitForChild("Humanoid").Animator:LoadAnimation(Animations.Holding)
I didnât copy the rest so it be easier to read also it now gives me a new error
Infinite yield possible on 'Players.wolfmanOs:WaitForChild(âShield1â)
You would have to check if those instances exist first then check for the animation folder. Also make sure youâre referencing the right thing or that itâs under the player object.
Let me see where youâre putting you animations in the explorer because if itâs still erroring or yielding youâre either referencing the wrong thing or it doesnât exist.
Youâre trying to get the shields from the player object you need to get it from the character instead. Just replace Player with Player.Character should fix your issue.
I forgot to mention since youâre using a local script the remote events do not pass player variables so delete that and redefine player as game.Players.LocalPlayer
Dont worry after hours i found a simpler way and it worked but thanks also for your help.
And sorry i didnât see your last reply because i was trying to change the way am making the player doing the animation.