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: Alright, so a problem

Previous Thread :: Next Thread 
ColdSmoke is online. ColdSmoke
Joined: 02 Jan 2012
Total Posts: 5784
28 Dec 2013 12:13 PM
Made simple script to clone a basic npc out of replicatedstorage to somewhere near the node.

Basically it knows there is 0 spawns, but it refuses to clone TownsPerson

while wait() do
local InModel = script.Parent:GetChildren()
local Spawns = #InModel-1
local RanX = math.random(-10,10)
local RanZ = math.random(-10,10)
print(Spawns)
if Spawns < 3 then
local Spawn = Game.ReplicatedStorage.TownsPerson:clone()
Spawn.Torso.CFrame = CFrame.new(script.Parent.Position+Vector3.new(RanX,5,RanZ))
end
end
Report Abuse
ColdSmoke is online. ColdSmoke
Joined: 02 Jan 2012
Total Posts: 5784
28 Dec 2013 12:13 PM
oh you know what i need to set its parent


thanks
Report Abuse
Azureous is not online. Azureous
Joined: 29 Jan 2012
Total Posts: 25287
28 Dec 2013 12:14 PM
I was about to say you needed to parent it.
Report Abuse
ColdSmoke is online. ColdSmoke
Joined: 02 Jan 2012
Total Posts: 5784
28 Dec 2013 12:16 PM
ok new problem why don't the random variables change every time?
Report Abuse
Azureous is not online. Azureous
Joined: 29 Jan 2012
Total Posts: 25287
28 Dec 2013 12:18 PM
Eh I don't know lol.

Report Abuse
Alex4897 is not online. Alex4897
Joined: 06 Aug 2008
Total Posts: 14517
28 Dec 2013 12:18 PM
Because when it's getting a random number it's choosing -10 of them. Pretty sure it has to be (1, 10).

I am an eggspert in the eggcelent art of egg puns.
Report Abuse
ColdSmoke is online. ColdSmoke
Joined: 02 Jan 2012
Total Posts: 5784
28 Dec 2013 01:06 PM
aww
Report Abuse
ColdSmoke is online. ColdSmoke
Joined: 02 Jan 2012
Total Posts: 5784
28 Dec 2013 01:09 PM
nope

i changed -10 to 1 and they still all spawn at the same spot
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