tech/game

21/07/31 Roblox Custom Animation (Player)

tech-lover 2021. 7. 31. 12:04

Roblox Studio Tutorial: How to Create Custom Player Animations

 

https://youtu.be/xlo4vKSYRoY

In a LocalScript under StarterPlayerScripts

```

local part = game.Workspace.Part

local click = part.ClickDetector

local Players = game:GetService("Players")

local character = Players.LocalPlayer.Character

if not character then

    character = Players.LocalPlayer.CharacterAdded:Wait()

end

 

local humanoid = character:WaitForChild("Humanoid")

local myAnimation = Instance.new("Animation")

myAnimation.AnimationId = "rbxassetid://04822814884"

 

local myAnimationTrack = humanoid:LoadAnimation(myAnimation)

local function animate()

    myAnimationTrack:Play()

end

 

click.MouseClick:Connect(animate)

```