#please tell me how to play an animation on a player
1 messages · Page 1 of 1 (latest)
send ss how you tried to load animation
local animId = "rbxassetid://111933425067630"
local function playAnimation(character)
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:FindFirstChildOfClass("Animator")
if not animator then
animator = Instance.new("Animator")
animator.Parent = humanoid
end
local animation = Instance.new("Animation")
animation.AnimationId = animId
local track = animator:LoadAnimation(animation)
track.Priority = Enum.AnimationPriority.Action
track:Play()
end
Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
playAnimation(character)
end)
end)```
Is that your animation?
yea
It's server script?
yea
It's better to load animation on local script
oh
** You are now Level 3! **
Put your local script in starter character scripts
also i wanted to ask how do i check if its work ? ```local Players = game:GetService("Players")
local ANIMATION_ID = "rbxassetid://111933425067630"
local character = Players.LocalPlayer.Character or Players.LocalPlayer.CharacterAdded:Wait()
local function playAnimation(character)
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:FindFirstChildOfClass("Animator")
if not animator then
animator = Instance.new("Animator")
animator.Parent = humanoid
end
local animation = Instance.new("Animation")
animation.AnimationId = ANIMATION_ID
local track = animator:LoadAnimation(animation)
track.Priority = Enum.AnimationPriority.Action
track:Play()
end
task.wait(3)
playAnimation(character)
@soft flume
just join game
Make sure you are loading the correct rig type animation depending on what your game uses
i made this but it doesnt work
local player = game.Players.LocalPlayer
local rs = game:GetService("ReplicatedStorage")
local Anims = rs.Anims
local Garou = Anims.Garou
local Hits = Garou.Hits
local Anim = Hits.Hit1
UIS.InputBegan:Connect(function(input, GameProcessed)
if GameProcessed then return end
if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
local character = player.Character
if not character then return end
local humanoid = character:WaitForChild("Humanoid")
local track = humanoid:LoadAnimation(Anim)
track.Priority = Enum.AnimationPriority.Action
track:Play()
end
end)```
humanoid:LoadAnimation is deprecated, use animator instead. Make sure you set id for anim and anim is "Animation" instance
are u sure the animation works
local player = game.Players.LocalPlayer
local rs = game:GetService("ReplicatedStorage")
local Anims = rs.Anims
local Garou = Anims.Garou
local Hits = Garou.Hits
local Anim = Hits.Hit1
UIS.InputBegan:Connect(function(input, GameProcessed)
if GameProcessed then return end
if input.UserInputType == Enum.UserInputType.Touch or input.UserInputType == Enum.UserInputType.MouseButton1 then
local character = player.Character
if not character then return end
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:FindFirstChildOfClass("Animator") or Instance.new("Animator", humanoid)
local track = animator:LoadAnimation(Anim)
track.Priority = Enum.AnimationPriority.Action
track:Play()
end
end)