How do I make the animation play when the tool un-equips? I have a print that tells when it plays, but it isn't at all. No errors were showing, and no prints were showing (except the Humanoid error, but that doesn't matter. Animation still works.)
Code Leading to the tool:
Tool = script.Parent local tool = script.Parent local player = game.Players.LocalPlayer local Character = player.Character local players = game:GetService("Players") local SG = game:GetService("StarterGui")
Note: I can't remove Tool = script.Parent and local tool = script.Parent or it'll break.
Unequipped code:
Tool.Unequipped:Connect(function() local animation = Instance.new("Animation") animation.Name = "Idle" animation.AnimationId = "http://www.roblox.com/Asset?ID=4638055721" local animTrack = tool.Parent.Humanoid:LoadAnimation(animation) animTrack:Play() print("I'm working on it!") --This needs to show, but the animation is blocking it for some reason game.Lighting.Bloom.Enabled = false game.Lighting.ColorCorrection.Enabled = false game.Lighting.Ambient = Color3.new(0/255, 0/255 ,0/255) --Ignore the lighting effects end)
Found the Answer with some help!
Tool.Unequipped:Connect(function() local G = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(tool.(AnimationName)) G:Play() print("I'm working on it!") game.Lighting.Bloom.Enabled = false game.Lighting.ColorCorrection.Enabled = false game.Lighting.Ambient = Color3.new(0/255, 0/255 ,0/255) end)