I have about 10+ tools that have this local script parented into each of them. They are to play a different animation, that is when sprinting with the tool equipped and sprinting, it plays that animation. There's a animation parented with it as well. The problem is the error shows in the output whenever I reset. In line 22 give the error "LoadAnimation requires the Humanoid object (TechModel.Humanoid) to be a descendant of the game object.
Just saying but is there a efficient way to just use one animation sprint tool to parent all of the amongst tools? that would sound reasonable than to have each identical scripts in every tool.
Thanks if you can help.
-- Services local userInputService = game:GetService("UserInputService") local playersService = game:GetService("Players") local Player = game.Players.LocalPlayer local Character = Player.Character or Player.CharacterAdded:Wait() --local sp = script.Parent -- Variables local player = playersService.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() local humanoid = character:WaitForChild("Humanoid") local pcButton = Enum.KeyCode.LeftShift local xboxButton = Enum.KeyCode.ButtonL3 local IsEquipped = false local tool = script.Parent-- location of tool -- Animation local animation = script:WaitForChild("SprintAnim") local sprintTrack = humanoid:LoadAnimation(animation) -- Input controller userInputService.InputBegan:Connect(function(input, processed) if input.KeyCode == (pcButton or xboxButton) and not processed and IsEquipped then sprintTrack:Play(.1) end end) userInputService.InputEnded:Connect(function(input, processed) if input.KeyCode == (pcButton or xboxButton) and not processed then sprintTrack:Stop(.1) end end) --Character.ChildRemoved:Connect(function(RemovedChild) -- if RemovedChild:IsA("Tool") then -- sprintTrack:Stop(0) -- --the tool is unequipped -- --RemovedChild is the tool unequipped -- end --end) tool.Equipped:Connect(function() IsEquipped = true end) tool.Unequipped:Connect(function() IsEquipped = false sprintTrack:Stop(0) end)