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: Help with a script

Previous Thread :: Next Thread 
karateperson is not online. karateperson
Joined: 19 Feb 2010
Total Posts: 1988
29 Aug 2011 10:23 AM
function onTouched()
wait(5)
s1 = "There are "
s2 = " children in the game!"
c = #game.Workspace.GetChildren()
print(s1 + c + s2)
end

script.Parent.Touched.connect(onTouch)
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
29 Aug 2011 10:25 AM
function onTouched()
wait(5)
c = #game.Workspace:GetChildren()
print("There are ", c, " children in the game")
end

script.Parent.Touched.connect(onTouched)
Report Abuse
karateperson is not online. karateperson
Joined: 19 Feb 2010
Total Posts: 1988
29 Aug 2011 10:29 AM
What should it say in the output in edit mode? Because I got

Mon Aug 29 11:26:59 2011 - Touched is not a valid member of Workspace
Mon Aug 29 11:26:59 2011 - Script "Workspace.Script", Line 7
Mon Aug 29 11:26:59 2011 - stack end
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
29 Aug 2011 10:29 AM
...

The script needs to go in a Part.
Report Abuse
karateperson is not online. karateperson
Joined: 19 Feb 2010
Total Posts: 1988
29 Aug 2011 10:32 AM
...

Woops
Report Abuse
tdog158 is not online. tdog158
Joined: 08 Jul 2008
Total Posts: 5413
29 Aug 2011 10:33 AM
I just had to post... Lol
Report Abuse
karateperson is not online. karateperson
Joined: 19 Feb 2010
Total Posts: 1988
29 Aug 2011 10:34 AM
Mon Aug 29 11:32:28 2011 - Workspace.Part.Script:7: bad argument #1 to 'connect' (RBXScriptSignal expected, got function)
Mon Aug 29 11:32:28 2011 - Script "Workspace.Part.Script", Line 7
Mon Aug 29 11:32:28 2011 - stack end
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
29 Aug 2011 10:35 AM
Sorry, there was one mistake I forgot to fix.

function onTouched()
wait(5)
c = #game.Workspace:GetChildren()
print("There are ", c, " children in the game")
end

script.Parent.Touched:connect(onTouched)
Report Abuse
karateperson is not online. karateperson
Joined: 19 Feb 2010
Total Posts: 1988
29 Aug 2011 10:38 AM
Oh thanks. Cause I was going to make a scripting tutorial. All others worked except that. And it's going to be a beginner tutorial.
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
29 Aug 2011 10:39 AM
Cool, but just remember, methods use a colon (:) not a period (.). :P
Report Abuse
karateperson is not online. karateperson
Joined: 19 Feb 2010
Total Posts: 1988
29 Aug 2011 10:41 AM
Ok, thanks!
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