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

why my animation doesnt want to play?

Asked by 5 years ago
Edited 5 years ago

Hi, im trying to play an animation when the player clicks, but nothing is happening. There is also no output.

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/Asset?ID=2309234897"
local char = plr:WaitForChild("Character")
local equipped = false
local tool = script.Parent

mouse.Button1Down:Connect(function()
    if equipped == true then
        local animTrack = char.Humanoid:LoadAnimation(anim)
        animTrack:Play()
        wait(2)
    end
end)

tool.Equipped:Connect(function()
    equipped = true
end)

tool.Unequipped:Connect(function()
    equipped = false
end
0
Do you have the animation published? aka Exported? mixgingengerina10 223 — 5y
0
Yes i uploaded it Jabba171 16 — 5y
0
Is it a local or a normal script? mixgingengerina10 223 — 5y
1
Local script in a tool Jabba171 16 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

Maybe, this will work, We can try switching the statements, by making the equipped function first and then the mouse.Button1Down

localscript:

local plr = game.Players.LocalPlayer
local mouse = plr:GetMouse()
local anim = Instance.new("Animation")
anim.AnimationId = "http://www.roblox.com/Asset?ID=2309234897"
local char = plr:WaitForChild("Character")
local equipped = false
local tool = script.Parent

tool.Equipped:Connect(function()
 mouse.Button1Down:Connect(function()
     local animTrack = char.Humanoid:LoadAnimation(anim)
     animTrack:Play()
     wait(2)
 end)
end)

0
Looks solid too me. AlphaGamer150 101 — 5y
0
I agree looks quite good. BunicornBoy 17 — 5y
0
Sadly doesnt work maybe my animation doesnt work Jabba171 16 — 5y
0
Sorry for the late response, try adding prints between each line mixgingengerina10 223 — 5y
Ad

Answer this question