Try using this
--Varibles
local Tool = script.Parent
local Handle = Tool:WaitForChild("Handle")
local DrinkSound = Handle:WaitForChild("DrinkSound")
local OpenSound = Handle:WaitForChild("OpenSound")
local animId = "rbxassetid://7210431772"
local NewAnimation = Instance.new("Animation")
NewAnimation.Parent = Tool
NewAnimation.AnimationId = animId
NewAnimation.Name = "Drink Animation"
local ToolCooldown = 1
function ToolActivated()
local Character = Tool.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
Animator:LoadAnimation(NewAnimation)
DrinkSound:Play()
wait(ToolCooldown)
function ToolEquip()
OpenSound:Play()
end
Tool.Activated:Connect(ToolActivated)
Tool.Equipped:Connect(ToolEquip)
Tell me if it works or not
I THINK IT’S KINDA WORKING!
It stopped the tool from moving, which is a HUGE relief, although the animation still doesn’t play.
Can you send screenshots of the Output and check if the animation Ids are correct (if not, swap the text in the script with the right animation id)
Can you send what Line 40
is in your script?
local inv = player:WaitForChild("Tools")
So the error you sent has nothing to do with the code I sent. The error is basically saying that there is nothing in the player named “Tools”
The tool needs to be parented with the player?
The tool needs to be in StarterPack
Oh, I see. Thank you so much!
I’m just gonna fix it and get back to you.
Thanks, if you run into any problems or errors send screenshots! Best way to show people the problem.
I will suggest disabling that script and create a new one. With the new script put the script I sent (and only my script) and see if it works or not. If it works and you have problems with other things create a new topic.
I put it in, and again, it kinda works, as in the tools don’t move (probably because I disabled the preloaded script that moved them), but the animation doesn’t play.
You put the script in Workspace
. Put it in StarterPack
Replace the Bloxy Cola script with this:
--Varibles
local Tool = script.Parent
local Handle = Tool:WaitForChild("Handle")
local DrinkSound = Handle:WaitForChild("DrinkSound")
local OpenSound = Handle:WaitForChild("OpenSound")
local animId = "rbxassetid://7210431772"
local NewAnimation = Instance.new("Animation")
NewAnimation.Parent = Tool
NewAnimation.AnimationId = animId
NewAnimation.Name = "Drink Animation"
local ToolCooldown = 1
function ToolActivated()
local Character = Tool.Parent
local Humanoid = Character:WaitForChild("Humanoid")
local Animator = Humanoid:WaitForChild("Animator")
Animator:LoadAnimation(NewAnimation)
DrinkSound:Play()
wait(ToolCooldown)
end
function ToolEquip()
OpenSound:Play()
end
Tool.Activated:Connect(ToolActivated)
Tool.Equipped:Connect(ToolEquip)
Tell me if it works or not
The sounds are playing! Thank you so much!
The animation still can’t be played though, I don’t know if the problem is with the animation itself.
The animation is for the player, where the character moves, not the tool, by the way, just in case that is causing trouble.
Yes I know that the animation is for the character, that’s what the script is meant to do. Make sure that the animation priority is set to action.
I’ll always accept a solution