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 |
|
|
|
| 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
|
  |
| Joined: 19 Jul 2011 |
| Total Posts: 28 |
|
|
| 30 May 2015 01:24 AM |
| MouseButton1 is left click, right? |
|
|
| Report Abuse |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 30 May 2015 09:57 PM |
| How's your scripting going? |
|
|
| Report Abuse |
|
|
| |
|