Localscript in tool not working

local UIS = game:GetService("UserInputService")
local anim = Instance.new("Animation")
anim.AnimationId = "rbxassetid://6745226472"
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Animate = Character:WaitForChild("Animate")



local loadanim = script.Parent:WaitForChild("Humanoid").Animator:LoadAnimation(anim)
loadanim:AdjustWeight(math.huge)
local debounce = false
UIS.InputBegan:Connect(function(input)
	print("Zero")
	if script:FindFirstAncestorWhichIsA("Workspace") then
		print("One")
		if input.UserInputType == Enum.UserInputType.MouseButton1 then
			print("Two")
			if debounce == false then
				print("Three")
			debounce = true
			local controls = require(game:GetService("Players").LocalPlayer.PlayerScripts.PlayerModule):GetControls()
			controls:Disable()
			loadanim:Play()
			loadanim.Stopped:Wait()
			print(debounce)
			controls:Enable()
		end
		debounce = false
	end
end
end)

nothing prints, which means the script doesn’t even register inputchanged

Mind showing us where the script is in explorer?


Here it is

local loadanim = script.Parent:WaitForChild("Humanoid").Animator:LoadAnimation(anim)

This never completes, because Tool doesn’t have a child named Humanoid. Try changing it to Character:WaitForChild("Humanoid").Animator:LoadAnimation(anim) instead.

2 Likes