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

Multiple animations played with one script?

Asked by 7 years ago
Edited 7 years ago

Right so here is what I have so far:



Tool = script.Parent local player = game.Players.LocalPlayer repeat wait() until player.Character ~= nil local hum = player.Character:WaitForChild("Humanoid") Tool.Activated:connect(function(mouse) local animation = Tool.Taunt local AnimTrack = hum:LoadAnimation(animation) AnimTrack:Play() Tool.Unequipped:connect(function() AnimTrack:Stop() end) end)

And I want to make it so lets say I press L and it does another animation. I have no idea how to make this work. Also if I'm going to use keyboard inputs I'm guessing a local script correct?

1 answer

Log in to vote
0
Answered by 7 years ago

I am guessing that you know how to play animations by your main post.

I like to use UserInputService, so for the letter L:

function onKeyPress(inputObject, gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.L then
        --Animation code here!
    end
end

game:GetService("UserInputService").InputBegan:connect(onKeyPress) --When a key is pushed down(Not when released)

The link below should be easy for you to use keyboard inputs. http://bfy.tw/7dpT

Ad

Answer this question