tonyo1
|
  |
| Joined: 13 Aug 2009 |
| Total Posts: 2059 |
|
|
| 02 Oct 2013 11:03 PM |
Example: "Model1" has a 40% chance of spawning when a server is created? |
|
|
| Report Abuse |
|
|
| |
|
tonyo1
|
  |
| Joined: 13 Aug 2009 |
| Total Posts: 2059 |
|
|
| 02 Oct 2013 11:09 PM |
| But, does such a script exist? |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2013 11:11 PM |
| Your acting like you can't make a script for that. |
|
|
| Report Abuse |
|
|
|
| 02 Oct 2013 11:13 PM |
"But, does such a script exist?"
lol. |
|
|
| Report Abuse |
|
|
tonyo1
|
  |
| Joined: 13 Aug 2009 |
| Total Posts: 2059 |
|
|
| 02 Oct 2013 11:13 PM |
Yeah, Me and scripting don't get along together. |
|
|
| Report Abuse |
|
|
tonyo1
|
  |
| Joined: 13 Aug 2009 |
| Total Posts: 2059 |
|
| |
|
ZachBloxx
|
  |
| Joined: 26 Jun 2013 |
| Total Posts: 2833 |
|
| |
|
|
| 02 Oct 2013 11:16 PM |
| Thank you for the grammar correction Zach. :C |
|
|
| Report Abuse |
|
|
ZachBloxx
|
  |
| Joined: 26 Jun 2013 |
| Total Posts: 2833 |
|
|
| 02 Oct 2013 11:56 PM |
| lel sorry i just liek grammar |
|
|
| Report Abuse |
|
|
|
| 03 Oct 2013 12:18 AM |
| umg u i spe;; i wong it suposed to be I gez |
|
|
| Report Abuse |
|
|
|
| 03 Oct 2013 12:43 AM |
function X(ch,ma) local ma = Game:FindFirstChild(ma,true)if not ma then return end local function cal(m,n) local x,y=m,0; for i = 1, m do if x < n then break end x=x-n; y=y+1; end return y+(x > 0 and x/y or 0) end if math.random(cal(100,ch))==1 then ma:clone().Parent=workspace end end
X(25, 'Road') |
|
|
| Report Abuse |
|
|
|
| 03 Oct 2013 12:44 AM |
forgot something a lot easier
function X(ch,ma) if math.random(ch/100)==1 then ma:clone().Parent=workspace end end
X(25, 'Road') |
|
|
| Report Abuse |
|
|
|
| 03 Oct 2013 12:45 AM |
function X(ch,ma) local ma = Game:FindFirstChild(ma,true)if not ma then return end if math.random(ch/100)==1 then ma:clone().Parent=workspace end end
X(25, 'Road')
forgot about finding map |
|
|
| Report Abuse |
|
|
tonyo1
|
  |
| Joined: 13 Aug 2009 |
| Total Posts: 2059 |
|
|
| 03 Oct 2013 01:09 AM |
Thanks. Could you tell me how to edit it please? (like I said above, me and scripting don't get along together very well) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 03 Oct 2013 01:16 AM |
You don't get along because you aren't willing to learn it.
|
|
|
| Report Abuse |
|
|
tonyo1
|
  |
| Joined: 13 Aug 2009 |
| Total Posts: 2059 |
|
|
| 03 Oct 2013 01:20 AM |
Well, the cavemen taught me scripting but then a giant shark took part of my brain out and I lost my scripting skills forever. Very emotional story. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 03 Oct 2013 01:22 AM |
I prefer my safer way of random:
math.random(100) <= X |
|
|
| Report Abuse |
|
|
tonyo1
|
  |
| Joined: 13 Aug 2009 |
| Total Posts: 2059 |
|
| |
|
Marolex
|
  |
| Joined: 17 Dec 2012 |
| Total Posts: 1785 |
|
|
| 03 Oct 2013 08:40 AM |
| "Knowledge is power" this completely applys in scripting and don't bump when you already received help... |
|
|
| Report Abuse |
|
|
|
| 03 Oct 2013 10:38 AM |
| I actually want to know too. Someone please explain the script above. |
|
|
| Report Abuse |
|
|
XAXA
|
  |
| Joined: 10 Aug 2008 |
| Total Posts: 6315 |
|
|
| 03 Oct 2013 11:13 AM |
local model = game.Lighting.MODEL -- declare your model here local rand = math.random() -- generates a random number between 0 and 1 if rand < 0.4 then -- if the random number is < 40 (a 40% chance) local modelClone = model:Clone() -- clones model modelClone.Parent = Workspace -- parents it to workspace modelClone:Moveto(Vector3.new(1,1,1)) -- moves it to a specific spot end -- ends "if"
--Now put these in a function and fire it. |
|
|
| Report Abuse |
|
|
tonyo1
|
  |
| Joined: 13 Aug 2009 |
| Total Posts: 2059 |
|
| |
|
|
| 03 Oct 2013 11:59 AM |
| @XAXA: How come I get an error on the first line of code? |
|
|
| Report Abuse |
|
|
|
| 03 Oct 2013 12:01 PM |
| It happens when I put the script into a function. |
|
|
| Report Abuse |
|
|