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: Character Animation Bound to a Single Button?

Previous Thread :: Next Thread 
Stokking is not online. Stokking
Joined: 19 Jul 2011
Total Posts: 28
30 May 2015 01:03 AM
Say I want to make the player character roll when a button is pressed. I already made a rolling animation, but how do I create a script that will make the animation happen when a button is pressed? How do I set the player character to a "humanoid?"
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
30 May 2015 01:09 AM
Let's say you have a LocalScript inside a button, and an Animation stored inside the Player itself.

local player=game.Players.LocalPlayer
local button=script.Parent
local animation=player:WaitForChild("TestAnimation") --name of your animation
local debounce=false

local char=player.Character
local hum=char:WaitForChild("Humanoid")
local loadedAnimation=hum:LoadAnimation(animation) --load the animation

button.MouseButton1Down:connect(function()
if hum and debounce==false then --make sure player can't spam click it
debounce=true
loadedAnimation:Play() --play the animation we loaded
wait(2) --change '2' to the length of your animation
loadedAnimation:Stop()
debounce=false --player can animate again
end
end)
Report Abuse
Stokking is not online. Stokking
Joined: 19 Jul 2011
Total Posts: 28
30 May 2015 01:24 AM
MouseButton1 is left click, right?
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
30 May 2015 01:29 AM
http://wiki.roblox.com/index.php?title=API:Class/GuiButton/MouseButton1Down
"Fired when the mouse is in the left mouse down state on the GUI object."

MouseButton2Down is the right mouse.
Report Abuse
Stokking is not online. Stokking
Joined: 19 Jul 2011
Total Posts: 28
30 May 2015 01:31 AM
I tried doing the thing, and left click doesn't make a player character do anything, so I think that the animation isn't loaded, or I created the animation wrongly, but I don't much understand what any of these fancy words mean, so is there like a roblox crash course in coding I can take?
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
30 May 2015 01:37 AM
Start here:
http://wiki.roblox.com/index.php/Absolute_beginner%27s_guide_to_scripting

Follow the wiki tutorials. It'll be a lot of reading but absolutely worth it. After a few tutorials look at a few videos as welol.

Videos

Basic Scripting:
https://www.youtube.com/watch?v=0LiaEDui2vE
https://www.youtube.com/watch?v=dqyJk0w2AY0
https://www.youtube.com/watch?v=8ejtpQAYfpk
https://www.youtube.com/watch?v=khn6kcU55oM

>How to make a Murder Mystery game
I don't suggest you actually make a Murder game, but follow along with this tutorial when you're intermediate in scripting and have basic knowledge of FilteringEnabled. This is a good tutorial for intermediate scripters and covers FilteringEnabled here and there. Also covers some nice building at the start.
https://www.youtube.com/watch?v=m4lWTgI_WQM&list=PLuEQ5BB-Z1PJkNQvGPu5-tUsyFykLtJgd
Report Abuse
nQqzRYVpIKA5jLP is not online. nQqzRYVpIKA5jLP
Joined: 05 Mar 2015
Total Posts: 4135
30 May 2015 01:38 AM
If you plan on making games or a game, you should learn about how the server-client model works.
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
30 May 2015 01:38 AM
Make sure:
The animation object is in the Player object
That code is pasted inside a LocalScript, inside your button
Report Abuse
Stokking is not online. Stokking
Joined: 19 Jul 2011
Total Posts: 28
30 May 2015 01:43 AM
I was actually using the Roblox wiki thing to look at the animation coding thing, but it's a little confusing, because there are so many terms I don't understand. I'll try reading it slower, thank you for your time, here's a Mario.

https://www.youtube.com/watch?v=65uNCLBTje0
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
30 May 2015 01:44 AM
Start at the very begging, like I said. If that page is confusing you, you know barely any scripting
Report Abuse
LongKillKreations is not online. LongKillKreations
Joined: 14 Feb 2014
Total Posts: 4502
30 May 2015 09:57 PM
How's your scripting going?
Report Abuse
DrTrayblox12345xD is not online. DrTrayblox12345xD
Joined: 03 Aug 2016
Total Posts: 19
30 Jul 2017 04:59 AM
were to put animation ID
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