I have this tool that when you interact it is gonna play an animation. but for some reason the animation isn't playing. any help would be great! also, nothing has been printing in the output here is the code:
local Players = game:GetService("Players") local character = Players.LocalPlayer.Character if not character then character = Players.LocalPlayer.CharacterAdded:Wait() end local humanoid = character:WaitForChild("Humanoid") local drinkAnim = Instance.new("Animation", character) drinkAnim.Name = "DrinkAnim" local drinkAnimID drinkAnim.AnimationId = "rbxassetid://10128937781" local animTrack = humanoid:LoadAnimation(drinkAnim) script.Parent.Handle.Drink.Triggered:Connect(function() script.Parent.Handle.Drink.Enabled = false animTrack:Play() script.Parent.Handle.DrinkSound:Play() wait(1) script.Parent:Destroy() end)
Try this:
local Players = game:GetService("Players") local character = Players.LocalPlayer.Character or Players.LocalPlayer.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local drinkAnim = Instance.new("Animation", character) drinkAnim.Name = "DrinkAnim" local drinkAnimID drinkAnim.AnimationId = "rbxassetid://10128937781" script.Parent.Handle.Drink.Triggered:Connect(function() local animTrack = humanoid:WaitForChild("Animator"):LoadAnimation(drinkAnim) animTrack.Priority = Enum.AnimationPriority.Action script.Parent.Handle.Drink.Enabled = false animTrack:Play() script.Parent.Handle.DrinkSound:Play() task.wait(1) script.Parent:Destroy() end)
Ok i figured out the problem, instead of a animation i used a decal Bruh.