my animation script won´t work, idk why there was also an error here:
local player = game.Players.LocalPlayer
local animid = "rbxassetid://11355266681 "
local newanim = Instance.new("Animation")
newanim.Parent = player
newanim.AnimationId = animid
local playanim = player.Character.Humanoid:LoadAnimator(newanim)
while wait(1) do
playanim:play()
end
You need to do a WaitForChild for everything when loading things from Client side.
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local playanim = animator:LoadAnimation(newanim)
local animid = "rbxassetid://11355266681 "
local newanim = Instance.new("Animation")
newanim.AnimationId = animid
local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animator = humanoid:WaitForChild("Animator")
local playanim = animator:LoadAnimation(newanim)
while wait(1) do
playanim:play()
end
If it’s not working then it’s the animation. Did you make it? Is it own by Roblox? If it’s not own by you or Roblox, it might not work if somebody else made it. If it’s a group game, you have to Publish to Roblox under the group’s name, not your name.
If it is still not working but code gives no errors then maybe you exported your animation with a priority of “Idle”
-- all code above...
local playanim = animator:LoadAnimation(newanim)
playanim.Priority = Enum.AnimationPriority.Action
while wait(1) do
playanim:Play()
end
There is no need to parent animation instances in order to play them or load them into an animator, actually you could just delete the Animation instance after loading it to the animator and as long as you store the AnimationTrack you would still be able to play it.