It’s my first time animating a player, and so I am not sure what is wrong here. I created the animation on an r15 dummy and set avatar game settings to r15.
Here is the script:
--variables and instances
local char = script.Parent
local human = char:WaitForChild("Humanoid")
local root = char:WaitForChild("HumanoidRootPart")
local Animation = (Instance.new("Animation",human))
local Animator = (human.Animator)
Animation.AnimationId = "rbxassetid://11495468435"
local run = human:LoadAnimation(Animation)
game.Workspace.AnimSaves1.Parent = human
local uis = game:GetService("UserInputService")
--functions
uis.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.W then
run:Play()
end
end
end)
I think you should do a Local of the AnimationId, because if it doesn’t do the AnimationId, this could be the problem.
--variables and instances
local Player = game.Players.LocalPlayer
local char = Player.Character
local human = char:WaitForChild("Humanoid")
local root = char:WaitForChild("HumanoidRootPart")
local Animation = (Instance.new("Animation",human))
local Animator = (human.Animator)
local AnimationId = "rbxassetid://11495468435"
local run = human:LoadAnimation(AnimationId)
game.Workspace.AnimSaves1.Parent = human
local uis = game:GetService("UserInputService")
--functions
uis.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.W then
run:Play()
end
end
end)
--variables and instances
local Player = game.Players.LocalPlayer
local char = Player.Character
local human = char:FindFirstChildOfClass("Humanoid")
local Animation = (Instance.new("Animation",human))
local Animator = human.Animator
Animation.AnimationId = "rbxassetid://11495468435"
local run = human:LoadAnimation(Animator and Animation)
game.Workspace.AnimSaves1.Parent = human
local uis = game:GetService("UserInputService")
--functions
uis.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.W then
run:Play("rbxassetid://11495468435")
end
end
end)
--variables and instances
local Player = game.Players.LocalPlayer
local char = Player.Character
local human = char:FindFirstChildOfClass("Humanoid")
local Animation = (Instance.new("Animation",human))
local Animator = human.Animator
Animation.AnimationId = "rbxassetid://11495468435"
local run = human:LoadAnimation(Animation)
game.Workspace.AnimSaves1.Parent = human
local uis = game:GetService("UserInputService")
--functions
uis.InputBegan:Connect(function(input)
if input.UserInputType == Enum.UserInputType.Keyboard then
if input.KeyCode == Enum.KeyCode.W then
run:Play("rbxassetid://11495468435")
end
end
end)
It might have something to do with the ownership of the animation. If you published the animation under a group and the experience you’re working on is under your account (or vice versa), the animation won’t be able to load. Is the experience and animation published under the same owner?