I finally did a script on my own, Even though I looked at free models and Forums to see how to put it together But here it is, please tell me how to stop the animation when I press Q again?
LOOK!! I already have the part where when I FIRST press Q The Animation DOES start(although my walkspeed doesnt change).. but when I press Q again IT DOESNT STOP, and my walkspeed doesnt change!! How do I MAKE IT STOP?!
wait(2) local player = game.Players.LocalPlayer local Mouse = player:GetMouse() Mouse.KeyDown:connect(function(key) if key == "q" then s = player.Character.Humanoid:LoadAnimation(game.StarterPack.AnimScrip.Animation) script.Parent.Parent.Parent.Humanoid.Walkspeed = 22 s:Play() elseif key == "q" then s = player.Character.Humanoid:LoadAnimation(game.StarterPack.AnimScrip.Animation) script.Parent.Parent.Parent.Humanoid.Walkspeed = 16 s:Stop() end end)
Well, not sure, but i bet this works:
wait(1) local player = game.Players.LocalPlayer local isP = false local Mouse = player:GetMouse() Mouse.KeyDown:connect(function(key) if key == "q" then if(isP==false)then isP=true local s = player.Character.Humanoid:LoadAnimation(game.StarterPack.LocalScript.Animation) s:Play() else isP=false local s2 = player.Character.Humanoid:LoadAnimation(0) s2:Play() end end end)
Hope this helps! If not, tell output...
You should search thoroughly though the wiki this website and other resources before asking a question here, it took me 2 minutes to find a similar question, of similar nature here.
Try this:
local player = game.Players.LocalPlayer local Mouse = player:GetMouse() s = player.Character.Humanoid:LoadAnimation(game.StarterPack.LocalScript.Animation) -- Define here Mouse.KeyDown:connect(function(key) if key == "q" then -- Needed a tab here s:Play() end end) Mouse.KeyUp:connect(function(key) if key == "q" then -- Needed a tab here s:Stop() end end)
Actually, Mystdar made a small mistake on line 13. Try this one:
local player = game.Players.LocalPlayer local Mouse = player:GetMouse() s = player.Character.Humanoid:LoadAnimation(game.StarterPack.LocalScript.Animation) -- Define here Mouse.KeyDown:connect(function(key) if key == "q" then -- Needed a tab here s:Play() end end) Mouse.KeyUp:connect(function(key) if key == "q" then -- Needed a tab here s:Stop() -- forgot to put () after stop end end)