Ok so, basically i made this localscript inside a tool to play an animation when the tool is activated, is something wrong with it?
local players = game:GetService("Players").LocalPlayer
local character = players.Character
local humanoid = character.Humanoid
local animation = script.Parent:WaitForChild("Animation")
local animator = humanoid:WaitForChild("Animator")
local loadAnim = animator:LoadAnimation(animation)
script.Parent.Equipped:Connect(function()
loadAnim:Play()
end)
local players = game:GetService("Players").LocalPlayer
local character = players.Character
local humanoid = character.Humanoid
local animation = script.Parent:WaitForChild("Animation")
local loadAnim = humanoid:LoadAnimation(animation)
script.Parent.Equipped:Connect(function()
loadAnim:Play()
end)
Also there’s something inside the Humanoid called the Animator, i think that’s how you use it now because Humanoid:LoadAnimation is not working anymore for what i know
local LocalPlayer = game.Players.LocalPlayer
local Humanoid = LocalPlayer.Character.Humanoid
local animation = script.Parent:WaitForChild("Animation")
script.Parent.Equipped:Connect(function()
if Humanoid then
local animator = Humanoid:FindFirstChildOfClass("Animator")
if animator then
local animationTrack = animator:LoadAnimation(animation)
animationTrack:Play()
end
end
end)
So this might help, when i rename the “Handle” to anything else, i can’t collect it from the ground and it doesn’t stay in my hand when i hold it but when i equip it the animation playes itself over and over
local LocalPlayer = game.Players.LocalPlayer
local Humanoid = LocalPlayer.Character.Humanoid
local animation = script.Parent:WaitForChild("Animation")
local Cooldown = false
script.Parent.Equipped:Connect(function()
if Humanoid then
local animator = Humanoid:FindFirstChildOfClass("Animator")
if animator and Cooldown == false then
Cooldown = true
local animationTrack = animator:LoadAnimation(animation)
animationTrack:Play()
end
end
end)
script.Parent.Unequipped:Connect(function()
Cooldown = false
end)
Okay here is what happens: u play the animation when the tool is equiped, but because of the part called Handle, roblox gives u his tool pack including welding to the hand and the pick up animation which overrides yours