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 » Scripting Helpers
Home Search
 

Re: Simple Touched Script

Previous Thread :: Next Thread 
pieinyofaceha is not online. pieinyofaceha
Joined: 09 May 2012
Total Posts: 2367
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 is not online. bob354293
Joined: 26 Oct 2008
Total Posts: 2609
11 Apr 2013 05:26 PM
Ever heard of output? O.o
Report Abuse
bob354293 is not online. 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
pieinyofaceha is not online. pieinyofaceha
Joined: 09 May 2012
Total Posts: 2367
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
pieinyofaceha is not online. pieinyofaceha
Joined: 09 May 2012
Total Posts: 2367
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 is not online. 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 is not online. 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 is not online. 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
pieinyofaceha is not online. pieinyofaceha
Joined: 09 May 2012
Total Posts: 2367
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
pieinyofaceha is not online. pieinyofaceha
Joined: 09 May 2012
Total Posts: 2367
11 Apr 2013 06:25 PM
Bump
Report Abuse
pieinyofaceha is not online. pieinyofaceha
Joined: 09 May 2012
Total Posts: 2367
11 Apr 2013 07:15 PM
Bumpedybump'o.
Report Abuse
pieinyofaceha is not online. pieinyofaceha
Joined: 09 May 2012
Total Posts: 2367
11 Apr 2013 09:00 PM
Bumpybumpson in Bumperville was Bumping his head on the bump tree!

DERPEDYDERPDERP.
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
11 Apr 2013 09:02 PM
https://www.youtube.com/watch?v=DkshOn0jRpw
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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