Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Animations not coming back to default ?

Hello. I made a tool that use a few action animations. The script brings the hand to the mouth, keeps it there while clicking then brings the hand back from where it started (drinking/eating script). The problem is that, even after i stopped them, if i'd unequip the tool the hand would remain in a position as if it was holding a tool. How can I fix this?

1 comment

0

pls add code

1 answer


script.Parent.Equipped:connect(function()
	local default = game.Players.LocalPlayer.Character.Torso.Default
	defaultT = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(default)
	defaultT:Play()
	script.Parent.Activated:connect(function()
		local player = game.Players.LocalPlayer
		local standstill = player.Character.Torso.StandStill
		standstillTrack = player.Character.Humanoid:LoadAnimation(standstill)
		local animation = player.Character.Torso.Animation
		animTrack = player.Character.Humanoid:LoadAnimation(animation)	
		defaultT:Stop()	
		animTrack:Play()
		wait(animTrack.Length)
		standstillTrack:Play()
	end)
	--
	script.Parent.Deactivated:connect(function()
		local handdown = game.Players.LocalPlayer.Character.Torso.HandDown
		animTrack3 = game.Players.LocalPlayer.Character.Humanoid:LoadAnimation(handdown)
		animTrack3:Play()
		defaultT:Play()
	end)
end)
script.Parent.Unequipped:connect(function()
	--[[
	animTrack:Stop()
	animTrack2:Stop()
	local handdown = player.Character.Torso.HandDown
	local animTrack3 = player.Character.Humanoid:LoadAnimation(handdown)
	animTrack3:Play()]]
	--anim = game.Players.
end)
mouse = game.Players.LocalPlayer:GetMouse()
mouse.KeyDown:connect(function(key)
	if(key=='f') then
		standstillTrack:Stop()
		animTrack3:Stop()
		animTrack:Stop()
		defaultT:Play()
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.