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 6 years ago
Edited 6 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 — 6y
0
Yes i uploaded it Jabba171 16 — 6y
0
Is it a local or a normal script? mixgingengerina10 223 — 6y
1
Local script in a tool Jabba171 16 — 6y

1 answer

Log in to vote
1
Answered by 6 years ago
Edited 6 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 — 6y
0
I agree looks quite good. BunicornBoy 17 — 6y
0
Sadly doesnt work maybe my animation doesnt work Jabba171 16 — 6y
0
Sorry for the late response, try adding prints between each line mixgingengerina10 223 — 6y
Ad

Answer this question