I need to know if there is any way to delete or somehow disable the animation that plays on default when equipping a tool.
I’ve looked around the dev forum and found a post relating to this but the solution involved using another animation to counteract it. I’ve also tried using this script, but it didn’t work.
for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
playingTracks:Stop()
end
To clarify, I’m looking for a way to delete the “Hand up” animation that plays on default when equipping a tool.
Here is my script:
local player = game:GetService("Players").LocalPlayer
local character
local humanoid
local idleAnim
local connection
script.Parent.Equipped:Connect(function()
character = player.Character or player.CharacterAdded:Wait()
humanoid = character:WaitForChild("Humanoid")
for _, playingTracks in pairs(humanoid:GetPlayingAnimationTracks()) do
playingTracks:Stop()
end
if not idleAnim then
idleAnim = humanoid:LoadAnimation(script:WaitForChild("Idle"))
end
idleAnim.Looped = true
idleAnim:Play()
connection = script.Parent.Activated:Connect(function()
end)
end)
script.Parent.Unequipped:Connect(function()
idleAnim:Stop()
connection:Disconnect()
end)
I believe creating your own type of handle could be a resolution. For that you would need to avoid using “Handle” and instead have the pseudo handle be cframed or welded to the players hand instead.
You can weld it on equip (or when the player spawns, it doesn’t matter) but it’s bad practice to destroy on unequip and weld it back on equip (unless you’re using weldconstraint). What you can do is once it’s welded, just hide and show on unequip/equip (by changing Transparency)
local player = game:GetService("Players").LocalPlayer
local character
local humanoid
local idleAnim
local connection
script.Parent.Equipped:Connect(function()
character = player.Character or player.CharacterAdded:Wait()
humanoid = character:WaitForChild("Humanoid")
local weld = Instance.new("Weld",script.Parent:WaitForChild("Gun"))
weld.Part0 = script.Parent:WaitForChild("Gun")
weld.Part1 = character["Right Arm"]
weld.C0 = CFrame.new(0, 0, 0) + Vector3.new(0,character["Right Arm"].Size.Y/2,0)
if not idleAnim then
idleAnim = humanoid:LoadAnimation(script:WaitForChild("Idle"))
end
idleAnim.Looped = true
idleAnim:Play()
connection = script.Parent.Activated:Connect(function()
end)
end)
script.Parent.Unequipped:Connect(function()
idleAnim:Stop()
connection:Disconnect()
end)
This is the script I use to disable the handle animation.
ServerScriptService:
local NOHANDOUT_ID = 04484494845
local function DisableHandOut(character)
local Animator = character.Animate
local Animation = Instance.new("Animation")
Animation.AnimationId = "http://www.roblox.com/asset/?id="..NOHANDOUT_ID
local ToolNone = Animator:FindFirstChild("toolnone")
if ToolNone then
local NewTool = Instance.new("StringValue")
NewTool.Name = "toolnone"
Animation.Name = "ToolNoneAnim"
Animation.Parent = NewTool
ToolNone:Destroy()
NewTool.Parent = Animator
end
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
DisableHandOut(character)
end)
end)
That’s called a workaround. You’re overriding the the default animation by playing another one yourself. Why do that when you can avoid the default animating being played in the first place? look at this for example: (note: this only shows how to weld on equip, does not handle unequip, but this should teach you what you’re looking for) HandleNoAnim.rbxl (20.2 KB)
EDIT: The other method is good if you want to play a custom default animation but not if you want to go ‘animation-less’ on default.
That’s a matter of situation. With your way, you have to stop that animation every time you want to play an animation for tool use, and then play it again after the use animation ends. Your way is the way to go (meaning the proper way) if you want a custom equip/idle animation for equip, but not if you sheerly want to remove the default equip/idle animation.
With my way, you don’t have to stop the animation and replay it again just as you don’t have to stop/replay the default handle animation. It literally has all the same behavior as a normal tool but just gets rid of the holding animation.