kanza
|
  |
| Joined: 09 Nov 2008 |
| Total Posts: 3260 |
|
|
| 30 Aug 2013 04:15 PM |
Using an already existing flight script, i've attempted to modify it to allow for an animation to be played when no key inputs are recieved, an idle animation of sorts.
However my limited knowledge of scripting leads to the animation becoming stuck and bugging out, due to the continous triggering of an "if". How do i work around this?
What i currently have:
if controls.right==0 and controls.left==0 and controls.backward==0 and controls.forward==0 then glideanim=humanoid:LoadAnimation(anim2) glideanim:Play() else glideanim:Stop() flyanim=humanoid:LoadAnimation(anim) end ------------------------- Obviously, the "if" is continously being triggered when i'm not moving, causing it to continously load and play the animation. |
|
|
| Report Abuse |
|
|
kanza
|
  |
| Joined: 09 Nov 2008 |
| Total Posts: 3260 |
|
| |
|
|
| 30 Aug 2013 04:43 PM |
Try using debouce. It prevents listeners from being used multiple times at once.
Example:
debounce = false
onTouched() if debouce = false then debounce = true
If blah blah blah blah then blah blah blah blah blah blah blah blah blah blah blah blah end debounce = false end
If that makes no sense, look it up on Wiki. |
|
|
| Report Abuse |
|
|
kanza
|
  |
| Joined: 09 Nov 2008 |
| Total Posts: 3260 |
|
|
| 30 Aug 2013 04:54 PM |
That didn't help, seeing as i had already tried that. >_<
I really need some kind of workaround.. |
|
|
| Report Abuse |
|
|
kanza
|
  |
| Joined: 09 Nov 2008 |
| Total Posts: 3260 |
|
| |
|
kanza
|
  |
| Joined: 09 Nov 2008 |
| Total Posts: 3260 |
|
| |
|
kanza
|
  |
| Joined: 09 Nov 2008 |
| Total Posts: 3260 |
|
| |
|
|
| 31 Aug 2013 05:22 AM |
| If I were you I would make a play button that loads the animation tbh, |
|
|
| Report Abuse |
|
|
kanza
|
  |
| Joined: 09 Nov 2008 |
| Total Posts: 3260 |
|
|
| 31 Aug 2013 05:26 AM |
Wait, what? What does this have to do with fixing the animation issues?
|
|
|
| Report Abuse |
|
|
|
| 31 Aug 2013 05:28 AM |
| You said that the animation is loading every time the player doesn't move. So just make the animation load on different conditions. |
|
|
| Report Abuse |
|
|
kanza
|
  |
| Joined: 09 Nov 2008 |
| Total Posts: 3260 |
|
|
| 31 Aug 2013 05:40 AM |
| I'm by no means adept at scripting, so i'll be blunt; i have no clue what you specifically mean by that. >_< |
|
|
| Report Abuse |
|
|