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 troubles

Previous Thread :: Next Thread 
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
07 Mar 2015 03:29 PM
I tried to make a script that play an animation when you equipped a gun:


tool = script.Parent


function onActivated() --when clicked

end

function onEquipped() -- when equipped
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=224251550"

local Humanoid = script.Parent.Parent.Humanoid

local animTrack = Humanoid:LoadAnimation(animation)
animTrack:Play()
wait()
end

tool.Activated:connect(onActivated)
tool.Equipped:connect(onEquipped)


It works when I un-equip the tool.
Try it for yourself on studio!


Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
07 Mar 2015 04:02 PM
Bump
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
08 Mar 2015 12:43 AM
Bump
Report Abuse
EllisLadon is not online. EllisLadon
Joined: 21 Jun 2012
Total Posts: 343
08 Mar 2015 01:55 AM
I'ma just throw something out here: It seems you've only got the one animation.

... Yeah.
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
08 Mar 2015 03:04 AM
I need it to play that animation while he holds the gun... FOREVER!
Report Abuse
matt1020304050 is not online. matt1020304050
Joined: 24 May 2008
Total Posts: 4475
08 Mar 2015 03:07 AM
Your code is fine

But you probably don't have a handle in your tool.

Insert a part in tool and name it "Handle"

And set up your code so the parents are to the tool.
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
08 Mar 2015 03:34 AM
I do have a Handle, where does the script go?

BTW I made a new script

local tool = script.Parent

local handle = tool:WaitForChild("Handle")


tool.Activated:connect(function() --when clicked
handle.FireSound.Volume = 15
handle.FireSound:Play()
end)

tool.Equipped:connect(function(mouse) -- when equipped
equipped = true
if mouse then
mouse.Icon = "rbxasset://textures\\GunCursor.png"
end
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=224251550"

local Humanoid = script.Parent.Parent.Humanoid

local animTrack = Humanoid:LoadAnimation(animation)
animTrack:Play()
wait()
end)



Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
08 Mar 2015 03:36 AM
BTW the animation is 0.20 seconds long. How do I play it for longer?
Report Abuse
matt1020304050 is not online. matt1020304050
Joined: 24 May 2008
Total Posts: 4475
08 Mar 2015 03:56 AM
You can have the script inside the tool or in the handle. It shouldn't matter.

But to make the animation longer you simply have to either make the animation longer or set it to looped.

There is a tick box to loop an animation when you're creating it.
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
08 Mar 2015 04:02 AM
so...

animation.Looped = true?
Report Abuse
matt1020304050 is not online. matt1020304050
Joined: 24 May 2008
Total Posts: 4475
08 Mar 2015 04:03 AM
No it's not a part of the script, I wish. But when you are creating the animation you have to set it as looped. You can't do it after it's been made.
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
08 Mar 2015 02:26 PM
cant get it to work
Report Abuse
KAAK82 is not online. KAAK82
Joined: 06 May 2014
Total Posts: 1166
08 Mar 2015 02:30 PM
Animation.Parent = something? heard of .Parent???
and about the Speed...
AnimTrack:AdjustSpeed(1.5) --will Play 1.5 Times Faster than it should...
Report Abuse
Barbariancreep is not online. Barbariancreep
Joined: 23 Nov 2012
Total Posts: 1096
09 Mar 2015 12:31 PM
Nope, only works when I un-equip the gun.
Report Abuse
Roblok1 is not online. Roblok1
Joined: 27 Jul 2011
Total Posts: 2019
09 Mar 2015 12:35 PM
in order for animations to work, u need to put the code in a local script.
Report Abuse
KAAK82 is not online. KAAK82
Joined: 06 May 2014
Total Posts: 1166
09 Mar 2015 01:06 PM
ya mean after u Unequip it or JUST wen u Unequip it?
Report Abuse
Kevenpowers is not online. Kevenpowers
Joined: 01 Sep 2012
Total Posts: 453
09 Mar 2015 01:34 PM
Dude since you're having problems with ROBLOX animations you should use CFrame.
Because these ROBLOX animations are annoying so CFrame animations are much more better trust me.

p = game.Players.LocalPlayer
c = p.Character

bd = c.HumanoidRootPart.RootJoint -- Torso's CFrame
a1 = c.Torso:FindFirstChild("Left Shoulder") -- Left Arm's CFrame
a2 = c.Torso:FindFirstChild("Right Shoulder") -- Right Arm's CFrame
l1 = c.Torso:FindFirstChild("Left Hip") -- Left Leg's CFrame
l2 = c.Torso:FindFirstChild("Right Hip") -- Right Leg's CFrame

for i = 1,5 do wait() -- CFrame Animation
a2.C0 = a2.C0 * CFrame.Angles(0,0,0.2)
end
for i = 1,5 do wait() -- CFrame Animation
a2.C0 = a2.C0 * CFrame.Angles(0,0.2,0)
end

(rotation,rotate left/right,up/down)
Report Abuse
FalconLoverGiraffe is not online. FalconLoverGiraffe
Joined: 24 Jun 2014
Total Posts: 456
09 Mar 2015 01:44 PM
just loop the animation

if the loop interrupts ur script use a coroutine
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