|
| 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 |
|
|
| |
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 14 Jun 2014 10:23 PM |
| It will either wait 1, 2, 3 or 4 seconds before dropping the next brick. |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 14 Jun 2014 10:26 PM |
| It resets the value of 'lol' because it is within the loop |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 14 Jun 2014 10:30 PM |
| @fur May as well do what I did. math.random(-50, 50) ._. |
|
|
| Report Abuse |
|
|
|
| 14 Jun 2014 10:31 PM |
| more values = more possibilities :3 |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 14 Jun 2014 10:34 PM |
| Dat, would be truly amazing |
|
|
| Report Abuse |
|
|
|
| 14 Jun 2014 10:35 PM |
| oh yea, put those numbers into an array, not a variable |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
| |
|
|
| 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 |
|
|
| |
|
|
| 14 Jun 2014 10:39 PM |
| @fur math.random only takes 2 arguments... |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 14 Jun 2014 10:39 PM |
| Alright, thanks. It worked. |
|
|
| Report Abuse |
|
|