|
| 11 Apr 2013 05:24 PM |
I don't see the problem with this script, but for some reason it's not working.
What it's supposed to do is clone "Eggson" and then when it's touched, get put into debris, but only if it's touched by a humanoid.
I also have a different script that SPAWNS the "Eggson"s, ask me if you want to see it.
Here's the script:
wait(2) debounce = true
function onTouched(hit) local human = hit.Parent:findFirstChild("Humanoid") if human ~= nil and debounce == true then _m = _m - 1 print("1") game.Debris:AddItem(script.Parent,0) print("2") debounce = false wait(2) debounce = true print(m) end end script.Parent.Touched:connect(onTouched) print("3")
Fairly basic, and I don't know why this is malfunctioning.
Please reply,
-pie |
|
|
| Report Abuse |
|
|
bob354293
|
  |
| Joined: 26 Oct 2008 |
| Total Posts: 2609 |
|
| |
|
bob354293
|
  |
| Joined: 26 Oct 2008 |
| Total Posts: 2609 |
|
|
| 11 Apr 2013 05:27 PM |
| the _m bit doesn't look right to me... |
|
|
| Report Abuse |
|
|
|
| 11 Apr 2013 05:27 PM |
Forgot to tell you.
The output is a mess of random numbers between what I'm trying to print between the two scripts, and the while loops are making them repeat themselves.
I could remove them.
No error in the output. |
|
|
| Report Abuse |
|
|
|
| 11 Apr 2013 05:28 PM |
_m is a global variable.
An underscore makes "m" viewabe by all scripts.
Or so I've heard.
Also, as soon as they touch the baseplate, they're gone (the "Eggson"s). |
|
|
| Report Abuse |
|
|
killjoy37
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 2821 |
|
|
| 11 Apr 2013 05:29 PM |
| What's the point of adding it to debris just to have it immediately removed? |
|
|
| Report Abuse |
|
|
killjoy37
|
  |
| Joined: 27 Aug 2008 |
| Total Posts: 2821 |
|
|
| 11 Apr 2013 05:30 PM |
to use global variables, do this _G.m = 0 |
|
|
| Report Abuse |
|
|
bob354293
|
  |
| Joined: 26 Oct 2008 |
| Total Posts: 2609 |
|
|
| 11 Apr 2013 05:30 PM |
Urm...
Explain what you want the script to do in more detail...? ill try and do a whole script that works for you... ?? :P |
|
|
| Report Abuse |
|
|
|
| 11 Apr 2013 05:35 PM |
I'm building this little fanmade egg hunt thing for fun and to improve my lua programming skills.
What I want the scripts to do is this:
Clone in a random spot every random number of seconds between 500 and 6000. (just one second for testing purposes.)
When you touch the brick, it disappears (only if humanoid).
It should clone them only if there are less than 3 in the Workspace.
It will delete them every so often (I changed the "every so often" time to 1000 to avoid them being deleted soon.)
I hope this is enough information, thanks for offering to re-write it.
Also, if you happen to have knoledge on this subject, I also need it to know (even when you leave) if you have gotten an egg.
Thanks for reading. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 11 Apr 2013 09:00 PM |
Bumpybumpson in Bumperville was Bumping his head on the bump tree!
DERPEDYDERPDERP. |
|
|
| Report Abuse |
|
|
UnBuild
|
  |
| Joined: 22 Mar 2013 |
| Total Posts: 3233 |
|
|
| 11 Apr 2013 09:02 PM |
| https://www.youtube.com/watch?v=DkshOn0jRpw |
|
|
| Report Abuse |
|
|