I'm pretty new to scripting and i'm trying to make a tron disk that when you click it plays an animation and attacks. The problem is, I don't know where to start. I've tried pasting and modifying other scripts into it but they never work. Even things like this /
-- Waits for the child of the specified parent local function WaitForChild(parent, childName) while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end return parent[childName] end
local Tool = script.Parent
local Animations = {} local MyHumanoid local MyCharacter
local function PlayAnimation(animationName) if Animations[animationName] then Animations[animationName]:Play() end end
local function StopAnimation(animationName) if Animations[animationName] then Animations[animationName]:Stop() end end
function OnEquipped(mouse) MyCharacter = Tool.Parent MyHumanoid = WaitForChild(MyCharacter, 'Humanoid') if MyHumanoid then Animations['EquipAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'EquipAnim5')) Animations['IdleAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'IdleAnim3')) Animations['OverheadAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'OverheadAnim2')) Animations['SlashAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'SlashAnim2')) Animations['ThrustAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'ThrustAnim2')) Animations['UnequipAnim'] = MyHumanoid:LoadAnimation(WaitForChild(Tool, 'UnequipAnim2')) end PlayAnimation('EquipAnim') PlayAnimation('IdleAnim') end
function OnUnequipped() for animName, _ in pairs(Animations) do StopAnimation(animName) end end
Tool.Equipped:connect(OnEquipped) Tool.Unequipped:connect(OnUnequipped)
WaitForChild(Tool, 'PlaySlash').Changed:connect( function (value) --if value then PlayAnimation('SlashAnim') --else -- StopAnimation('SlashAnim') --end end)
WaitForChild(Tool, 'PlayThrust').Changed:connect( function (value) --if value then PlayAnimation('ThrustAnim') --else -- StopAnimation('ThrustAnim') --end end)
WaitForChild(Tool, 'PlayOverhead').Changed:connect( function (value) --if value then PlayAnimation('OverheadAnim') --else -- StopAnimation('OverheadAnim') --end end)
If someone could help me figure out scripting this sort of thing it would help out alot! Thanks!

6 comments
Please enclose your code in the blocks created when you press the Lua logo above the question edit box.
http://wiki.roblox.com/index.php?title=Animations
I know how to make the animations but now how to put them into tools is what i'm saying
The humanoid plays the animation, you can google 'humanoid' and 'animation' and it should bring you directly to it.
Ugh it didn't work. Here's a video I made with the problem: https://www.youtube.com/watch?v=-Z2C5xqcr0g
Script an animation that shows the player throwing the disk for the arm that's holding the disk. From there, just remove the tool from the player's character and put it in a safe place. Then just duplicate the parts and make it fly.