Ok, so first, you need to try to find a way to get the player, and if this is a normal tool in the starter pack or a tool that will get cloned into the player's backpack sometime soon, then the variable
local player = script.Parent.Parent.Parent
would work.
And now we need to get our player's character
local player = script.Parent.Parent.Parent
local character = player.Character or player.CharacterAdded:Wait()
and now we need to get our tool, and the animationObject
local player = script.Parent.Parent.Parent
local character = player.Character or player.CharacterAdded:Wait()
local tool = script.Parent
local animation = pathToAnimation
local animationTrack
And you need to be fimiliar with the Equipped event.
local player = script.Parent.Parent.Parent
local character = player.Character or player.CharacterAdded:Wait()
local tool = script.Parent
local animation = pathToAnimation
local animationTrack
tool.Equipped:Connect(function()
end)
So now, we need to go to the Humanoid and load the animation with Humanoid:LoadAnimation.
And your final product should look like this:
local player = script.Parent.Parent.Parent
local character = player.Character or player.CharacterAdded:Wait()
local tool = script.Parent
local animation = pathToAnimation
local animationTrack
tool.Equipped:Connect(function()
animationTrack = character:WaitForChild("Humanoid"):LoadAnimation(animation)
animationTrack:Play()
end)
4 comments
Guys, i dont think hes actually from the moon.
no, he is, from Moon, South Dakota
yes and im from mars
are you bruno mars