generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Animation/Tools

Previous Thread :: Next Thread 
robloxianmirror is not online. robloxianmirror
Joined: 16 Dec 2012
Total Posts: 3
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 is not online. 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 is not online. 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 is not online. 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
robloxianmirror is not online. robloxianmirror
Joined: 16 Dec 2012
Total Posts: 3
12 Nov 2016 11:16 AM
Thanks!


"MADATTAK WHY YOU DO 'DIS?" - Shedletsky
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image