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

Issues Basic Animation, Tried multiple priorities/codes/methods, how to make it run?

Asked by 3 years ago
Edited 3 years ago

I am having trouble playing a basic animation that moves the right arm. I have exported the animation using core and action priority and tried both but to no prevail.

Past Code:

local tool = script.Parent
local handle = tool:WaitForChild("Handle")

local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/Asset?ID=6775492058/"
local playAnim = humanoid:LoadAnimation(anim)


tool.Equipped:Connect(function()
    ---Any code in here is executed when the tool is equiped
    print("Equipped")
end)

tool.Activated:Connect(function()
    ---Any code in here is executed when the tool is clicked
    print("Tool Clicked")

    playAnim:Play()


end)

-----------------------------------------------------------

tool.Unequipped:Connect(function()
    print("Equipped")
end)

tool.Deactivated:Connect(function()
    print("deactivated")
end)

Layout: https://cdn.discordapp.com/attachments/831309729149354004/840119456210485268/unknown.png

Current Code:

local tool = script.Parent
local handle = tool:WaitForChild("Handle")

local player = game:GetService("Players").LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")

local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/Asset?ID=6780383259"
---rbxassetid://6780383259

local playAnim = humanoid:LoadAnimation(anim)
---local playAnim = tool:WaitForChild("Animation")

---playAnim = humanoid:LoadAnimation(playAnim)
playAnim.Priority = Enum.AnimationPriority.Action

tool.Equipped:Connect(function()
    ---Any code in here is executed when the tool is equiped
    print("Equipped")
end)

tool.Activated:Connect(function()
    ---Any code in here is executed when the tool is clicked
    print("Tool Clicked")

    playAnim:Play()

    print("Executed")


end)

-----------------------------------------------------------

tool.Unequipped:Connect(function()
    print("Equipped")
end)

tool.Deactivated:Connect(function()
    print("deactivated")
end)

Current Layout: https://cdn.discordapp.com/attachments/831309729149354004/840196046436958229/unknown.png

Output: https://cdn.discordapp.com/attachments/831309729149354004/840198539350245396/unknown.png

Showing what happens: https://gyazo.com/2d59284d5f67ad204da388d9ffffb2e5

What the animation is: https://gyazo.com/6f770d8f6f8f02e4d163a709f70a6683

Answer this question