I made a cup recently, and have a script to animate it. So far, when I activate the cup, the sound for it plays, but nothing else happens. I have an idle animation(which is looped), and a drinking animation. I don't know what is wrong with the script. Note: The Drink and idle animations are stored in the local script(which is the script this code is in)

local canDrink = true

script.Parent.Equipped:Connect(function()
	local DrinkAnim = script.Parent.Parent.Humanoid:LoadAnimation(script.Drinking)
	local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
	idle:Play()
end)

script.Parent.Activated:Connect(function()
		if canDrink = true then 
		canDrink = false
		local DrinkAnim = script.Parent.Parent.Humanoid:LoadAnimation(script.Drinking)		
		local sound = script.Parent.Handle.Drink
		local idle = script.Parent.Parent.Humanoid:LoadAnimation(script.Idle)
		idle:Stop()
		DrinkAnim:Play()
		sound:Play()
		wait(1.5)
		idle:Play()
		canDrink = true
		end
end)

5 comments

0

lets see the full script and is there errors in the output. you need to provide all of this when you go on this website.

0

this the full script. there are no output errors

0

Are you sure the drinking animation and idle animations have the right animation priority?

0

which priority should I set the anims to?(I'm very new to animations)

0

I did some research and changed the prioritys accordingly, now it works! Thanks for the help:D