hey so i am working on animations for the tools in my game and for some reason sometimes when you join the game the animations wont load and you cant use any tools until you reset your character. here is my current script:
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local hum = char:FindFirstChildOfClass("Humanoid")
local animations
if hum then
local animator = hum:FindFirstChildOfClass("Animator")
if animator then
animations = {{"AxeSwing",animator:LoadAnimation(game.ReplicatedStorage.Animations.AxeSwing)};
{"AxeSwingHigh",animator:LoadAnimation(game.ReplicatedStorage.Animations.AxeSwingHigh)};
{"PickaxeSwing",animator:LoadAnimation(game.ReplicatedStorage.Animations.PickaxeSwing)};
{"PickaxeSwingHigh",animator:LoadAnimation(game.ReplicatedStorage.Animations.PickaxeSwingHigh)};
}
end
end
plr.CharacterAdded:Connect(function(char)
wait(1)
local hum = char:FindFirstChildOfClass("Humanoid")
if hum then
local animator = hum:FindFirstChildOfClass("Animator")
if animator then
animations={
{"AxeSwing",animator:LoadAnimation(game.ReplicatedStorage.Animations.AxeSwing)};
{"AxeSwingHigh",animator:LoadAnimation(game.ReplicatedStorage.Animations.AxeSwingHigh)};
{"PickaxeSwing",animator:LoadAnimation(game.ReplicatedStorage.Animations.PickaxeSwing)};
{"PickaxeSwingHigh",animator:LoadAnimation(game.ReplicatedStorage.Animations.PickaxeSwingHigh)};
}
end
end
end)