Hello! I am having some errors when trying to play an animation I made with an object and the player. May I know what is wrong and how to fix it? Error message
local prompt = script.Parent.ProximityPrompt
prompt.Triggered:Connect(function(player)
local character = game.Workspace:WaitForChild(player.Name)
if character:FindFirstChildWhichIsA("Tool") then
local tool = character:FindFirstChildWhichIsA("Tool")
if tool.Name == "Steamer" then
tool:Destroy()
local hrp = character:WaitForChild("HumanoidRootPart")
hrp.CFrame = game.Workspace:WaitForChild("Rig1").HumanoidRootPart.CFrame
local humanoid = character:WaitForChild("Humanoid")
humanoid.WalkSpeed = 0
local animation = script.Animation
local pan = game.ServerStorage.Charsiewbaopan:Clone()
local animationcontroller = pan:WaitForChild("AnimationController")
local animation1 = pan:WaitForChild("AnimationController"):WaitForChild("Animation")
local animator = animationcontroller:WaitForChild("Animator")
local track1 = animator:LoadAnimation(animation1)
local track = humanoid:LoadAnimation(animation)
pan.Parent = game.Workspace
track1:Play()
track:Play()
prompt.Enabled = false
track.Stopped:Wait()
pan:Destroy()
prompt.Enabled = true
humanoid.WalkSpeed = 16
end
end
end)
Ok I added the object to the workspace and the animation played for the character however, the object animation didn’t play. What is wrong with it? Here is the script
local prompt = script.Parent.ProximityPrompt
prompt.Triggered:Connect(function(player)
local character = game.Workspace:WaitForChild(player.Name)
if character:FindFirstChildWhichIsA("Tool") then
local tool = character:FindFirstChildWhichIsA("Tool")
if tool.Name == "Steamer" then
tool:Destroy()
local hrp = character:WaitForChild("HumanoidRootPart")
hrp.CFrame = game.Workspace:WaitForChild("Rig1").CFrame
local humanoid = character:WaitForChild("Humanoid")
humanoid.WalkSpeed = 0
local animation = script.Animation
local pan = game.ServerStorage.Charsiewbaopan:Clone()
pan.Parent = game.Workspace
local animationcontroller = pan:WaitForChild("AnimationController")
local animation1 = pan:WaitForChild("AnimationController"):WaitForChild("Animation")
local animator = animationcontroller:WaitForChild("Animator")
local track1 = animator:LoadAnimation(animation1)
local track = humanoid:LoadAnimation(animation)
track1:Play()
track:Play()
prompt.Enabled = false
track.Stopped:Wait()
pan:Destroy()
prompt.Enabled = true
humanoid.WalkSpeed = 16
end
end
end)
As you can see, the pan didn’t move and I want it to move. I did what it state in the Roblox website but the pan still didn’t seem to move? may I know how to fix that?