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