How do I load animations into a bloxy cola tool?

I’ve been trying to load animations into a bloxy cola tool, however, I do not know how to do so. I looked up tutorials to put in tool animations in-game, but they don’t work. I’m using the default bloxy cola tool, please help me, I’m desperate at this point.

Here’s the pre-loaded script in the tool, in case it helps :

--Stickmasterluke was here last


sp=script.Parent

enabled = true




function onActivated()
	if not enabled  then
		return
	end

	enabled = false
	sp.GripForward = Vector3.new(0,-.759,-.651)
	sp.GripPos = Vector3.new(1.5,-.5,.3)
	sp.GripRight = Vector3.new(1,0,0)
	sp.GripUp = Vector3.new(0,.651,-.759)


	sp.Handle.DrinkSound:Play()

	wait(3)

	local s=script.EnergyScript:clone()
	s.Parent=sp.Parent
	s.Disabled=false

	sp.GripForward = Vector3.new(-.976,0,-0.217)
	sp.GripPos = Vector3.new(0.03,0,0)
	sp.GripRight = Vector3.new(.217,0,-.976)
	sp.GripUp = Vector3.new(0,1,0)

	wait(1)
	sp:remove()

end

function onEquipped()
	sp.Handle.OpenSound:play()
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)

Please help.

1 Like

try this and make sure to put in the animation id:

--Stickmasterluke was here last


sp=script.Parent

enabled = true

local anim = "rbxassetid://[anim id]"
local animTrack = script.Parent.Humanoid:LoadAnimation(anim)


function onActivated()
	if not enabled  then
		return
	end

	enabled = false
	
	animTrack:Play()

	sp.Handle.DrinkSound:Play()

	wait(3)

	local s=script.EnergyScript:clone()
	s.Parent=sp.Parent
	s.Disabled=false

	animTrack:Stop()

	wait(1)
	sp:remove()

end

function onEquipped()
	sp.Handle.OpenSound:play()
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
1 Like

It’s still not working, the animation won’t play.

I hope I’ve put in the script correctly?

Sorry, here:

--Stickmasterluke was here last


sp=script.Parent

enabled = true

local anim = "rbxassetid://[anim id]"


function onActivated()
local animTrack = script.Parent.Parent:WaitForChild("Humanoid"):LoadAnimation(anim)
	if not enabled  then
		return
	end

	enabled = false
	
	animTrack:Play()

	sp.Handle.DrinkSound:Play()

	wait(3)

	local s=script.EnergyScript:clone()
	s.Parent=sp.Parent
	s.Disabled=false

	animTrack:Stop()

	wait(1)
	sp:remove()

end

function onEquipped()
	sp.Handle.OpenSound:play()
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)
1 Like

You can’t load a string to create an animation track, instead you should do something like this:

local animId = "rbxassetid://7210431772"
local anim = Instance.new("Animation")
anim.AnimationId = animId
local animTrack = script.Parent.Humanoid:LoadAnimation(anim)
1 Like

It’s still not working, sorry. I’m extremely sorry for the inconvenience.

I might’ve made a mistake in the script, although I don’t know where. Please help.

Trying this out right now. Thank you so much.

I need to only put this into the script, right? Is there anything else I need to put?

You would replace local anim = id which you have before with this

1 Like

I tried that, but it’s still not working. I’m extremely sorry for being such a burden. Here, I’ll give all the scripts I have in the tool :

--Stickmasterluke was here last


sp=script.Parent

enabled = true




function onActivated()
	if not enabled  then
		return
	end

	enabled = false
	sp.GripForward = Vector3.new(0,-.759,-.651)
	sp.GripPos = Vector3.new(1.5,-.5,.3)
	sp.GripRight = Vector3.new(1,0,0)
	sp.GripUp = Vector3.new(0,.651,-.759)


	sp.Handle.DrinkSound:Play()

	wait(3)

	local s=script.EnergyScript:clone()
	s.Parent=sp.Parent
	s.Disabled=false

	sp.GripForward = Vector3.new(-.976,0,-0.217)
	sp.GripPos = Vector3.new(0.03,0,0)
	sp.GripRight = Vector3.new(.217,0,-.976)
	sp.GripUp = Vector3.new(0,1,0)

	wait(1)
	sp:remove()

end

function onEquipped()
	sp.Handle.OpenSound:play()
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)

Here’s the next one

--Stickmasterluke


sp=script.Parent


local h=sp:FindFirstChild("Humanoid")
local t=sp:FindFirstChild("Torso")
if h~=nil and t~=nil and h.Health>0 then
    local f=Instance.new("Fire")
    f.Color=Color3.new(1,0,0)
	f.SecondaryColor=Color3.new(1,1,1)
    f.Size=3
    f.Heat=2
	f.Parent=t
    h.WalkSpeed=32
	wait(15)
    h.WalkSpeed=28
    wait(15)
    h.WalkSpeed=24
    wait(15)
    h.WalkSpeed=20
    wait(15)
    h.WalkSpeed=16
    if f~=nil then
	    f:remove()
    end
end
script:remove()

And then the final one to put load in the animations

--Stickmasterluke was here last


sp=script.Parent

enabled = true

local animId = "rbxassetid://7210431772"
local anim = Instance.new("Animation")
anim.AnimationId = animId
local animTrack = script.Parent.Humanoid:LoadAnimation(anim)


function onActivated()
    local animTrack = script.Parent.Parent:WaitForChild("Humanoid"):LoadAnimation(anim)
    if not enabled  then
	    return
    end

    enabled = false

    animTrack:Play()

    sp.Handle.DrinkSound:Play()

    wait(3)

    local s=script.EnergyScript:clone()
    s.Parent=sp.Parent
    s.Disabled=false

    animTrack:Stop()

    wait(1)
    sp:remove()

end

function onEquipped()
    sp.Handle.OpenSound:play()
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)

Hi,

Can you tell me what this script is parented to? (in the handle of the tool or in the actual tool):

--Stickmasterluke was here last


sp=script.Parent

enabled = true

local animId = "rbxassetid://7210431772"
local anim = Instance.new("Animation")
anim.AnimationId = animId
local animTrack = script.Parent.Humanoid:LoadAnimation(anim)


function onActivated()
    local animTrack = script.Parent.Parent:WaitForChild("Humanoid"):LoadAnimation(anim)
    if not enabled  then
	    return
    end

    enabled = false

    animTrack:Play()

    sp.Handle.DrinkSound:Play()

    wait(3)

    local s=script.EnergyScript:clone()
    s.Parent=sp.Parent
    s.Disabled=false

    animTrack:Stop()

    wait(1)
    sp:remove()

end

function onEquipped()
    sp.Handle.OpenSound:play()
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)


1 Like

It’s parented to the tool itself.

I believe you would want to do

local anim = Instance.new("Animation")
anim.AnimationId = "" --Anim Id Here
anim.Parent = script.Parent

 local animTrack = script.Parent.Parent:WaitForChild("Humanoid"):WaitForChild("Animator"):LoadAnimation(anim)
1 Like

Humanoid can no longer Load Animations as Roblox has migrated to using Humanoid.Animator

More information here:

Animator:LoadAnimation

1 Like

I need to put only this into the tool, correct? Not anything else?

Put what in the tool?

If you’re referring to the script I just posted, put it where you would want to load the animation (such as tool.Activated)

1 Like

I’m really sorry for being such a burden, but I don’t know anything about scripting. Could you please tell me where in this script would I put your script? :

--Stickmasterluke was here last


sp=script.Parent

enabled = true

local animId = "rbxassetid://7210431772"
local anim = Instance.new("Animation")
anim.AnimationId = animId
local animTrack = script.Parent.Humanoid:LoadAnimation(anim)


function onActivated()
    local animTrack = script.Parent.Parent:WaitForChild("Humanoid"):LoadAnimation(anim)
    if not enabled  then
        return
    end

    enabled = false

    animTrack:Play()

    sp.Handle.DrinkSound:Play()

    wait(3)

    local s=script.EnergyScript:clone()
    s.Parent=sp.Parent
        s.Disabled=false

    animTrack:Stop()

    wait(1)
    sp:remove()

end

function onEquipped()
    sp.Handle.OpenSound:play()
end

script.Parent.Activated:connect(onActivated)
script.Parent.Equipped:connect(onEquipped)

Thank you so much for the help, and sorry for the inconvenience.

Here would be a finalized version:

--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()

Tool.Activated:Connect(ToolActivated)
Tool.Equipped:Connect(ToolEquip)

This would be a script under your Tool

Tell me if you run into any problems with this script. And if it does end up working, I wouldn’t mind marking this as a solution :slight_smile:

2 Likes

It’s still not working.

Is there a way I can load the animation into the player itself? Instead of having it in the tool?

I’m really sorry for bothering you and so many others for so long.
Atleast this problem has finally given me the motivation to learn scripting I guess.

I HIGHLY suggest learning to script so I’m glad you’re motivated.

Does the output have any errors? (Screenshots recommended!)

To answer your question there is no current way to load animations onto the player, only the character

1 Like