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: Boundrey for clones?

Previous Thread :: Next Thread 
Blueguy195 is not online. Blueguy195
Joined: 17 Nov 2012
Total Posts: 7258
14 Jun 2014 10:15 PM
Is there a way for me to copy a brick then have it spawn in a zone, randomly? Here's the script:

-----------------------------------------

local PPC = game.Lighting.PP:Clone()

while wait() do

wait(3)
PPC.Parent = Workspace
PPC.CFrame = CFrame.new(-7, 25.2, -11)

end

-----------------------------------------
Report Abuse
Blueguy195 is not online. Blueguy195
Joined: 17 Nov 2012
Total Posts: 7258
14 Jun 2014 10:16 PM
BUMP
Report Abuse
xXfurheadXx is not online. xXfurheadXx
Joined: 22 Oct 2012
Total Posts: 409
14 Jun 2014 10:19 PM
local PPC = game.Lighting.PP
PPC:Clone().Parent = (game.Workspace)
PPC.CFrame = CFrame.new(-7,25.2,-11)

There is no randomness in the code you wrote, and why would you want it repeating? Anyway...

local PPC = game.Lighting.PP
while true do
PPC:Clone().Parent = (game.Workspace)
PPC.CFrame = CFrame.new(-7,25.2,-11)
wait(3)
end
Report Abuse
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
14 Jun 2014 10:19 PM
PPC.CFrame = CFrame.new(math.random(-50,50), math.random(0,100), math.random(-50,50))

Change the values. Each math.random means it will choose a random number between the 2 numbers you give it.
Report Abuse
Blueguy195 is not online. Blueguy195
Joined: 17 Nov 2012
Total Posts: 7258
14 Jun 2014 10:20 PM
Well because Im trying to get it to rain the blocks. But randomly because they are going to be filled with player points
Report Abuse
xXfurheadXx is not online. xXfurheadXx
Joined: 22 Oct 2012
Total Posts: 409
14 Jun 2014 10:22 PM
local PPC = game.Lighting.PP
while true do
lol = math.random(1,2,3,4)
PPC:Clone().Parent = (game.Workspace)
PPC.CFrame = CFrame.new(-7,25.2,-11)
wait(lol)
end
Report Abuse
xXfurheadXx is not online. xXfurheadXx
Joined: 22 Oct 2012
Total Posts: 409
14 Jun 2014 10:23 PM
It will either wait 1, 2, 3 or 4 seconds before dropping the next brick.
Report Abuse
Blueguy195 is not online. Blueguy195
Joined: 17 Nov 2012
Total Posts: 7258
14 Jun 2014 10:25 PM
No, Im asking for a boundary for the brick to spawn. So I have the baseplate and I want the player points to only spawn on the baseplate but kinda up in the sky a little.
Report Abuse
xXfurheadXx is not online. xXfurheadXx
Joined: 22 Oct 2012
Total Posts: 409
14 Jun 2014 10:26 PM
It resets the value of 'lol' because it is within the loop
Report Abuse
xXfurheadXx is not online. xXfurheadXx
Joined: 22 Oct 2012
Total Posts: 409
14 Jun 2014 10:28 PM
local PPC = game.Lighting.PP
while true do
lol=math.random(-50,-40,-30,20,-10,0,10,20,30,40,50)
loll=math.random(-50,-40,-30,20,-10,0,10,20,30,40,50)
PPC:Clone().Parent = (game.Workspace)
PPC.CFrame = CFrame.new(lol, 50, loll)
wait(1)
end

the numbers of lol are x value
the numbers in loll are z value
Report Abuse
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
14 Jun 2014 10:30 PM
@fur May as well do what I did. math.random(-50, 50) ._.
Report Abuse
xXfurheadXx is not online. xXfurheadXx
Joined: 22 Oct 2012
Total Posts: 409
14 Jun 2014 10:31 PM
more values = more possibilities :3
Report Abuse
xXfurheadXx is not online. xXfurheadXx
Joined: 22 Oct 2012
Total Posts: 409
14 Jun 2014 10:31 PM
I like using lol as a variable. lol--But what did that REALLY mean when I said lol?
Report Abuse
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
14 Jun 2014 10:34 PM
@fur For true randomness, do random math with a random user's user id that happens to be in the game xD
Report Abuse
Blueguy195 is not online. Blueguy195
Joined: 17 Nov 2012
Total Posts: 7258
14 Jun 2014 10:34 PM
22:33:51.038 - Workspace.Script:3: wrong number of arguments
22:33:51.038 - Script 'Workspace.Script', Line 3
22:33:51.038 - Stack End





That's what I get. :l
Report Abuse
xXfurheadXx is not online. xXfurheadXx
Joined: 22 Oct 2012
Total Posts: 409
14 Jun 2014 10:34 PM
Dat, would be truly amazing
Report Abuse
xXfurheadXx is not online. xXfurheadXx
Joined: 22 Oct 2012
Total Posts: 409
14 Jun 2014 10:35 PM
oh yea, put those numbers into an array, not a variable
Report Abuse
xXfurheadXx is not online. xXfurheadXx
Joined: 22 Oct 2012
Total Posts: 409
14 Jun 2014 10:36 PM
local PPC = game.Lighting.PP
while true do
local lol=math.random{-50,-40,-30,20,-10,0,10,20,30,40,50}
local loll=math.random{-50,-40,-30,20,-10,0,10,20,30,40,50}
PPC:Clone().Parent = (game.Workspace)
PPC.CFrame = CFrame.new(lol, 50, loll)
wait(1)
end
Report Abuse
Blueguy195 is not online. Blueguy195
Joined: 17 Nov 2012
Total Posts: 7258
14 Jun 2014 10:37 PM
22:36:58.973 - Workspace.Script:3: bad argument #1 to 'random' (number expected, got table)
22:36:58.973 - Script 'Workspace.Script', Line 3
22:36:58.974 - Stack End
Report Abuse
xXfurheadXx is not online. xXfurheadXx
Joined: 22 Oct 2012
Total Posts: 409
14 Jun 2014 10:38 PM
You got me, I don't know
Report Abuse
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
14 Jun 2014 10:38 PM
Was my post ignored? My script also comes with random wait() times for a better raining effect.


while true do
local PPC = game.Lighting.PP:Clone()
PPC.Parent = Workspace
PPC.CFrame = CFrame.new(math.random(-50,50), math.random(25,50), math.random(-50,50))
wait(math.random(2,4))
end
Report Abuse
Blueguy195 is not online. Blueguy195
Joined: 17 Nov 2012
Total Posts: 7258
14 Jun 2014 10:38 PM
Well darn.
Report Abuse
DiamondBladee is not online. DiamondBladee
Joined: 24 Feb 2013
Total Posts: 3527
14 Jun 2014 10:39 PM
@fur math.random only takes 2 arguments...
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
14 Jun 2014 10:39 PM
Well, to make it even more random, you could just simply do:
lol = math.random(-50,50)

But I think using a table could also work, also here: PPC:Clone().Parent = (game.Workspace)

I don't think you need parentheses for game.Workspace :P
Report Abuse
Blueguy195 is not online. Blueguy195
Joined: 17 Nov 2012
Total Posts: 7258
14 Jun 2014 10:39 PM
Alright, thanks. It worked.
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