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: Nothing appears under game.Workspace after this script!

Previous Thread :: Next Thread 
zorgan9220 is not online. zorgan9220
Joined: 25 Sep 2011
Total Posts: 2115
13 Jul 2014 07:29 AM
script:
local baseplate = Instance.new("Part", game.Workspace)
baseplate.Name = "Plate"
local sample = Instance.new("Part", game.Workspace)
baseplate.Position = Vector3.new(81, 46.2, -138)
baseplate.Rotation = sample.Rotation
baseplate.Size = Vector3.new(512, 1.2, 512)
baseplate.BrickColor = BrickColor.new("Bright green")
baseplate.Anchored = true
baseplate.Locked = true
sample:remove()
local spawnlocation = Instance.new("SpawnLocation", game.Workspace)
spawnlocation.Name = "Spawner"
spawnlocation.Position = baseplate.Position
spawnlocation.Transparency = 1
spawnlocation.CanCollide = false
spawnlocation.Locked = true
spawnlocation.Anchored = true
spawnlocation.Locked = true

game.Workspace:ClearAllChildren(game.Workspace.Spawner, game.Workspace.Plate)




It's supposed to create a baseplate with an instance of a SpawnLocation in the center of it, and then clear everything off workspace except Workspace.Spawner and Workspace.Plate

Did I do anything wrong?

-Common sense doesn't exist
Report Abuse
Drak0Master is not online. Drak0Master
Joined: 10 Aug 2009
Total Posts: 836
13 Jul 2014 07:36 AM
http://wiki.roblox.com/index.php?title=API:Instance/ClearAllChildren

I don't see any parameters for this API - such as for resuscitation.

:ClearAllChildren() will clear all children regardless of any pseudo parameters. You will have to copy-paste it before clearance.

Report Abuse
zorgan9220 is not online. zorgan9220
Joined: 25 Sep 2011
Total Posts: 2115
13 Jul 2014 07:41 AM
(putting parameters in it, I feel stupid now)

Yea, but if I put the :ClearAllChildren() before my create the baseplate and the spawnpoint, still, nothing is there under Workspace.

No parts, just a terrain and camera.

-Common sense doesn't exist
Report Abuse
Drak0Master is not online. Drak0Master
Joined: 10 Aug 2009
Total Posts: 836
13 Jul 2014 07:42 AM
Put a wait()
Report Abuse
zorgan9220 is not online. zorgan9220
Joined: 25 Sep 2011
Total Posts: 2115
13 Jul 2014 07:53 AM
wait(2)
game.Workspace:ClearAllChildren()
wait()

baseplate = Instance.new("Part", game.Workspace)
baseplate.Name = "Plate"
sample = Instance.new("Part", game.Workspace)
baseplate.Position = Vector3.new(81, 46.2, -138)
baseplate.Rotation = sample.Rotation
baseplate.Size = Vector3.new(512, 1.2, 512)
baseplate.BrickColor = BrickColor.new("Bright green")
baseplate.Anchored = true
baseplate.Locked = true
sample:remove()

spawnlocation = Instance.new("SpawnLocation", game.Workspace)
spawnlocation.Name = "Spawner"
spawnlocation.Position = baseplate.Position
spawnlocation.Transparency = 1
spawnlocation.CanCollide = false
spawnlocation.Locked = true
spawnlocation.Anchored = true
spawnlocation.Locked = true



Eh', so it waits for 2 seconds, then clears all children (i wanted to that happen), then it waits for a tick and then creates the stuff. If I don't put in the :ClearAllChildren(), the baseplate is created.
Is there something I'm missing that's supposed to break out of the argument (:ClearAllChildren())

-Common sense doesn't exist
Report Abuse
NiceCoder is not online. NiceCoder
Joined: 15 Oct 2012
Total Posts: 6593
13 Jul 2014 07:53 AM
you're clearing all the children from the workspace...
game.Workspace.Model:ClearAllChildren() or whatever the path is
Report Abuse
Waffloid is not online. Waffloid
Joined: 14 Jul 2011
Total Posts: 1606
13 Jul 2014 07:56 AM
Instead of the ClearAllChildren, copy this code at the beggining.

function ClearAllChild(pos,name)
for i,v in pairs(pos:GetChildren()) do
if v.Name == name then
v:Destroy()
end
end
end

So, if you want to remove all the parts named Spawner then you will write
ClearAllChild("Billy","Spawner").

Just make sure that it is not a object value, and you have that little code at the top.

~Swagilitious and not Nutricious~
Report Abuse
zorgan9220 is not online. zorgan9220
Joined: 25 Sep 2011
Total Posts: 2115
13 Jul 2014 08:01 AM
Ok, so I started a little bit of coding on top of the creation of the baseplate and spawnpoint, and I did this:

model = game.Workspace:GetChildren()
modelParent = Instance.new("Model", game.Workspace)
modelParent.Name = "ModelWorkspace"
model.Parent = game.Workspace.ModelWorkspace
modelParent:ClearAllChildren()


Now, that bit of code makes the model and names it, ModelWorkspace, but it has no children after the bit of code is executed.


-Common sense doesn't exist
Report Abuse
zorgan9220 is not online. zorgan9220
Joined: 25 Sep 2011
Total Posts: 2115
13 Jul 2014 08:07 AM
@WaffLoid: Nope, the baseplate and spawnpoint is created but, the 6 parts I put under Workspace isn't removed.

omg, this problem is going to give me headaches.

Here's the problem, again:

I want the script to remove everything in Workspace first and create a baseplate and spawnpoint in the middle of it, however, after the script removes everything in Workspace, nothing appears in Workspace.


-Common sense doesn't exist
Report Abuse
Waffloid is not online. Waffloid
Joined: 14 Jul 2011
Total Posts: 1606
13 Jul 2014 08:12 AM
Oh, I forgot! it was like this

ClearAllChild(game.Workspace,"Player","cheese")

~Swagilitious and not Nutricious~
Report Abuse
devSurface is not online. devSurface
Joined: 09 Feb 2013
Total Posts: 1339
13 Jul 2014 08:15 AM
Eh,
in what location is this script?

If its in workspace it'll get deleted to.

Report Abuse
zorgan9220 is not online. zorgan9220
Joined: 25 Sep 2011
Total Posts: 2115
13 Jul 2014 08:40 AM
@above: Then how da heck am I supposed to do this?

-Common sense doesn't exist
Report Abuse
Drak0Master is not online. Drak0Master
Joined: 10 Aug 2009
Total Posts: 836
13 Jul 2014 09:03 AM
Make it a LocalScript somewhere in your player. Perhaps a tool, GUI, or have a relay network to resurrect your code.
Report Abuse
zorgan9220 is not online. zorgan9220
Joined: 25 Sep 2011
Total Posts: 2115
13 Jul 2014 09:42 PM
^
Wouldn't my character and the localscript be deleted also?

Sword Dancing at Fat Camp With Starwars Kid
Report Abuse
zorgan9220 is not online. zorgan9220
Joined: 25 Sep 2011
Total Posts: 2115
14 Jul 2014 07:12 AM
@Drake0: I figured out what you mean, and I tried doing it, but I ended up with a non-responsive Roblox Studio.

Sword Dancing at Fat Camp With Starwars Kid
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