Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make Groups appear/disappear?

Asked by 6 years ago
Edited 6 years ago

Hello scripters! I have a question for my tcoon game i am currently working on. In there i have an elevator.

.. I have a elevator group generally, in there i have some more things. One group in the general group is called Floors. this group contains Floor1;Floor2 [...] which are groups aswell. I unchecked archiveable on Floor 2, so if i test the game It doesnt appear, thats good. Now i want that, if i click on a part (contains clickdetector) , code:

function Star() 
script.Parent.Parent.Parent.lift.Floors.Floor3.Archivable = true 
end
script.Parent.ClickDetector.MouseClick:connect(Star)

-- Now, i want if i click the Part, that thee Floor3 group becomes Visible and useable. But if i click it this error msg appears in the output:

Floor3 is not a valid Member of Model and nothing happens.So i want to Activate it with the clickdetector.

Joe

++++ REPOST! I know now Archivable makes it just save to game when i upload, but the title is better now. Also i have better chances of getting an answer. Ty++++

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

If you are wanting to have objects or geometry appear/disappear from the workspace, the best way to do it is to have the objects in ServerStorage and use a script if you are wanting the change to be seen by everyone, or ReplicatedStorage if you want to make changes locally in a LocalScript. You can then clone or destroy objects as needed. For example, each of your floor groups can be in ReplicatedStorage, and when you want a floor to appear you do:

local floor = game.ReplicatedStorage.Floor3:Clone()
floor.Parent = workspace.Elevator

Then to remove a floor would be:

workspace.Elevator.Floor2:Destroy()
Ad

Answer this question