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

How to make a group appear/disappear?

Asked by 7 years ago
Edited 7 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

1 answer

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago
Floor3 = script.Parent.Parent.Parent.lift.Floors.Floor3
Floor3Visible = false
function Star()
    if Floor3Visible then
        Floor3.Parent = game.ServerStorage --changes the parent of Floor3 to ServerStorage so it can't be interacted with
        Floor3Visible = false
    else
        Floor3.Parent = script.Parent.Parent.Parent.lift.Floors --Puts it back to where it was originally located so players can interact with it again
        Floor3Visible = true
    end
end
Star() --activates the function when the script starts so that Floor 3 isn't in workspace
script.Parent.ClickDetector.MouseClick:connect(Star)

This should work, hope it helps Your problem is using achievable. Archievable works by telling studio if an object should be saved or not when you publish/save. If an object is unarchievable then it won't be present in saved files or published games or when you test your game.

0
Archivable* Vezious 310 — 7y
0
Looks good, but i as i tried, the floor3 appeared Instantly as i buyed the lift ingame. launchpadguyjoe -5 — 7y
Ad

Answer this question