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 » Scripters
Home Search
 

Re: Why doesn't this block spawning script work?

Previous Thread :: Next Thread 
legoblockhead2001 is online. legoblockhead2001
Joined: 21 Mar 2011
Total Posts: 158
18 Feb 2017 04:35 PM
while true do
wait(0.01)
local p = Instance.new("Part")
p.Parent = game.Workspace
p.Position = Vector3.new ((math.random(-500, 500)),200,(math.random(-500,500)))
p.Size = Vector3.new( 3, 3, 3 )
p.BrickColor = BrickColor.new((math.random(0,255)), (math.random(0,255)),(math.random(0,255))
p.Transparency= 0
p.Reflectance= 0
p.Shape = Block
p.Locked = true
p.Anchored = false
p.CanCollide = false
p.Material = "Neon"


end


Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
18 Feb 2017 04:36 PM
the output window would tell you which line is causing an error
Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
18 Feb 2017 04:40 PM
The line that positions the part is wrong as well as the line that sets a random brickcolor as its colour.

Vector3.new(math.random(1, 255), math.random(1, 255), math.random(1, 255)

BrickColor = BrickColor.Random()
Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
18 Feb 2017 04:41 PM
Vector3.new(math.random(1, 255, math.random(1, 255), math.random(1, 255)) *
Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
18 Feb 2017 04:45 PM
also you should use this notation for setting enumerated values:
p.Shape = Enum.PartType.Block
p.Material = Enum.Material.Neon

looks more robust and less chance of making a mistake when you type
Report Abuse
legoblockhead2001 is online. legoblockhead2001
Joined: 21 Mar 2011
Total Posts: 158
18 Feb 2017 04:48 PM
Hmm, still not working.

Nice to see a Burd here though.


Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
18 Feb 2017 04:51 PM
You could try using a for loop instead of a while loop. It may be crashing your game.
Report Abuse
legoblockhead2001 is online. legoblockhead2001
Joined: 21 Mar 2011
Total Posts: 158
18 Feb 2017 04:51 PM
I got it to spawn a single brick at a random location, at which point no more spawn. Also, ### brick always is Light ##### Grey with dimensions of 2x4x1. ### material is also Plastic, so it appears to be spawning a normal brick at a random location
Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
18 Feb 2017 04:55 PM
After solving that riddle it looks like ### problem is at ### part where you set ### brick's size. Try this: p.Size = Vector3.new(3,3,3) without ### spaces
Report Abuse
Gomlsauresrex is not online. Gomlsauresrex
Joined: 25 Mar 2016
Total Posts: 3588
18 Feb 2017 04:59 PM
@Mister_Manakin

Btw Materials can use enums and strings.
Report Abuse
Mister_Manakin is not online. Mister_Manakin
Joined: 16 Sep 2009
Total Posts: 1935
18 Feb 2017 05:00 PM
I understand that. It's just a personal preference for using enums.
Report Abuse
legoblockhead2001 is online. legoblockhead2001
Joined: 21 Mar 2011
Total Posts: 158
18 Feb 2017 05:28 PM
Now I'm getting: "Workspace.Script:8: unexpected symbol near '='


Report Abuse
legoblockhead2001 is online. legoblockhead2001
Joined: 21 Mar 2011
Total Posts: 158
18 Feb 2017 05:28 PM
AYY WE DID IT ITS WORKING!

THANKS GUYS


Report Abuse
legoblockhead2001 is online. legoblockhead2001
Joined: 21 Mar 2011
Total Posts: 158
18 Feb 2017 05:30 PM
New challenge: How would I make the bricks spin randomly as they fall?


Report Abuse
legoblockhead2001 is online. legoblockhead2001
Joined: 21 Mar 2011
Total Posts: 158
18 Feb 2017 05:43 PM
Well, found out how! Now how do I make them fall slowly? I can make them jump up a bit before falling but I dont know how to impliment BodyVelocity


Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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