Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How would I do a on remote event play animation?

1 answer

✓ Accepted answer
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")

local LocalPlayer = Players.LocalPlayer
local Character = LocalPlayer.Character
local Humanoid = Character.Humanoid

 -- Replace with an animation asset of your own.
local AnimationID = '180436334'
local Key = 'k' -- You can change it to another key of your choice.

UserInputService.InputBegan:connect(function(Input, ...)
    if Input.KeyCode == Enum.KeyCode[(Key):upper()] then -- Checks key pressed
        local Anim = Instance.new("Animation") 
        Anim.AnimationId = ("rbxassetid://%s"):format(AnimationID)
        local Track = Humanoid:LoadAnimation(Anim)
        Track:Play() -- Runs animation.
    end
end)

I hope this could help out with you understanding more thoroughly on how to do it. Please take notes of this code and revise on it, and lastly have a merry christmas.

This discussion is preserved as it was. New answers, comments, and votes are closed.