I am trying to add an animation that will go around in circles when the player is sitting on a specific seat.
The server script, which is located in the seat, spawns the player on the seat, and is intended to run the animation over and over again until the player leaves the seat.
This was my previous working script.
local players = game:GetService('Players')
players.PlayerAdded:Connect(function(player)
local added
added = player.CharacterAdded:Connect(function(character)
added:Disconnect()
task.wait(0.1)
local humanoid = character:WaitForChild('Humanoid')
humanoid.JumpPower = 0
while not humanoid.Sit do
character:WaitForChild('HumanoidRootPart').CFrame = script.Parent.CFrame
task.wait()
humanoid.JumpPower = 50
end
end)
end)
This is my current, updated script.
local players = game:GetService('Players')
players.PlayerAdded:Connect(function(player)
local added
added = player.CharacterAdded:Connect(function(character)
added:Disconnect()
task.wait(0.1)
local humanoid = character:WaitForChild('Humanoid')
humanoid.JumpPower = 0
local animation = Instance.new("Animation")
animation.AnimationId = "https://www.roblox.com/library/9696052308/Keyboard-Typing"
local animationTrack = humanoid:LoadAnimation(animation)
animationTrack:Play()
while not humanoid.Sit do
character:WaitForChild('HumanoidRootPart').CFrame = script.Parent.CFrame
task.wait()
humanoid.JumpPower = 50
end
end)
end)
Unfortunately, an error pops up on the output:
Invalid animation id ‘<error: id not found in first 128 char for http AssetId>’: - Server - Script:12
and
12:35:39.770 Infinite yield possible on ‘Workspace:WaitForChild(“Humanoid”)’ - Studio
I tried to change something but it doesn’t work.
I used the article:
https://developer.roblox.com/en-us/api-reference/class/Animation
Have I done something wrong?