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.

01local plr = game.Players.LocalPlayer
02local mouse = plr:GetMouse()
03local anim = Instance.new("Animation")
05local char = plr:WaitForChild("Character")
06local equipped = false
07local tool = script.Parent
08 
09mouse.Button1Down:Connect(function()
10    if equipped == true then
11        local animTrack = char.Humanoid:LoadAnimation(anim)
12        animTrack:Play()
13        wait(2)
14    end
15end)
View all 23 lines...
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:

01local plr = game.Players.LocalPlayer
02local mouse = plr:GetMouse()
03local anim = Instance.new("Animation")
05local char = plr:WaitForChild("Character")
06local equipped = false
07local tool = script.Parent
08 
09tool.Equipped:Connect(function()
10 mouse.Button1Down:Connect(function()
11     local animTrack = char.Humanoid:LoadAnimation(anim)
12     animTrack:Play()
13     wait(2)
14 end)
15end)
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