(Not sure if it’s Prgoramming or Building, tell me which it is and I’ll move this)
Hello fellow Developers!
I have a question, so currently if I had an equip Animation and I play it, it wouldn’t work, and it would simply spawn the Tool after the Animation finished, but how would I go about making the Tool appear when the Animation is playing?
(The script I have is simply something like:
local function onEquip()
animation:Play()
animation.Ended:Wait()
equipped = true
end
tool.Equipped:Connect(onEquip)
It’s useless in this case as I’m simply asking if it’s even possible)
So from what I understand, you want a tool to be equipped once the animation starts playing, correct? If so, all you should do is play the animation first and call the Equip() function to the humanoid.
Example:
local tool -- your tool
local hum -- your humanoid
local anim -- your animation
-- after a given circumstance
animation:Play()
hum:EquipTool(tool)
I can provide the script, but I need to write it form my mind as I’m not at my PC right now, there’s Variables for the Humanoid, Tool, Aninations, Animatior, Character, and the Functions are:
local function onEquip()
print(“Equipped”)
equipAnim:Play()
equipAnim.Ended:Wait()
equipped = true
end
local function onUnequip()
print(“unequipped”)
unequipAnim:Play()
unequipAnim.Ended:Wait()
equipped = false
end
tool.Equipped:Connect(onEquip)
tool.Unequipped:Connect(onUnequip)
I can’t remember the exact path for the Variavbles tho
Everything works fine, only that the Animation plays but the tool appears only after the Animation ended when equipped, and stays mid-air when unequipped and then disappears
Is it okay to wait till I get home? It looks and sounds like everything should be working fine, but I could look into it more when I can access my computer.
Sorry for the late reply, if you want I can explain more the problem, I’m not at my PC right now, but I will try to explain
So, when I equip, this happens, the animation plays, but the sword appears only when the animation finishes, but when I unequip it, it stays in place until the animation finishes
local hum = script.parent.parent:FindFirstChild("Humanoid")
local Animation = -- where its located
local function onEquip()
local anim = hum.loadAnimation:(Animation)
anim:Play()
anim.Ended:Wait()
equipped = true
end
tool.Equipped:Connect(onEquip)
(I’m not gonna send the place file because I don’t know how to do that and I don’t wnat other people to have access to it, security purposes) and for the video I will share it when I can (even though I can’t from my PC fro some reason)
You can send the place file through DMs if you wish, but it is okay if you don’t. And to actually get the place file, it’s very simple. When in studio, you click file → save to file as
It will save the place file, which you can then send. But again, it’s okay if you don’t. It just makes solving this a bit more simple
o well…
you need to duplicate the handle name it “mainpart” or anything you want, then insert a new dummy
put the tool inside the dummy then “Motor6D” the handle with the part i named Mainpart then rig the dummys arm to the handle also done by “Motor6D” btw make the Handle invisible
then create an animation and make the weapon/tool appear from under the player or how you like it