|
| 10 Nov 2016 10:20 AM |
Can anyone reply with a code to play a custom asset when a tool is equipped and another code for when it is activated (clicked while holding), Thanks if you can. :D
MADATTAK WHY YOU DO 'DIS? - Shedletsky |
|
|
| Report Abuse |
|
|
mybowls72
|
  |
| Joined: 05 Aug 2013 |
| Total Posts: 2688 |
|
|
| 10 Nov 2016 10:38 AM |
Script.tool(Animation()
Function.WorkSpace.tool == Click print ("Get smacked kid.") GetChildren ( ) -- Name of tool end end) |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 10 Nov 2016 10:58 AM |
tool = script.Parent hum = script.Parent:FindFirstChild("Humanoid") idle = game.ReplicatedStorage:FindFirstChild("IdleAnimation") swing = game.ReplicatedStorage:FindFirstChild("SwingAnimation") -- make sure Swing's priority is second in line, so that it takes precedent over Idle refractory = false swingDuration = 1.0 -- in seconds
tool.Equipped:connect(function(mouse) idle:Play() tool.Activated:connect(function() if refractory == false then refractory = true swing:Play() -- do damage or something wait(swingDuration) end refractory = false end) end)
tool.Unequipped:connect(function() idle:Stop() swing:Stop() refractory = false end)
|
|
|
| Report Abuse |
|
|
mybowls72
|
  |
| Joined: 05 Aug 2013 |
| Total Posts: 2688 |
|
|
| 10 Nov 2016 11:02 AM |
local Soybeen = Stahp
if Soybeen = Stahp then print("Stahp it :/") end tool = script.Parent hum = script.Parent:FindFirstChild("Humanoid") idle = game.ReplicatedStorage:FindFirstChild("IdleAnimation") swing = game.ReplicatedStorage:FindFirstChild("SwingAnimation") -- make sure Swing's priority is second in line, so that it takes precedent over Idle refractory = false swingDuration = 1.0 -- in seconds print ("Soy stahp") tool.Equipped:connect(function(mouse) idle:Play() tool.Activated:connect(function() if refractory == false then refractory = true swing:Play() -- do damage or something wait(swingDuration) end refractory = false end) end)
tool.Unequipped:connect(function() idle:Stop() swing:Stop() refractory = false end)
|
|
|
| Report Abuse |
|
|
|
| 12 Nov 2016 11:16 AM |
Thanks!
"MADATTAK WHY YOU DO 'DIS?" - Shedletsky |
|
|
| Report Abuse |
|
|