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

Button only spawning individual parts, not model? [Continued]

Asked by 6 years ago

Basically, I already asked this question a while ago and got a somewhat decent answer that somewhat solved the problem, until I came up to this problem with these scripts, and I'll explain it in a moment.

My goal that I wanted to meet was being able to have a button, on being touched by a person, make a large model, consisting of NPCs within it, platforms, and even other large models to become fully visible and cancollide. If this doesn't make sense, here's the general thing Im trying to say: On button press, model appears which consists of other models, NPCs, and other buttons which can then spawn in other models, like a huge continuing chain of events that continues every step of the way once a button has been touched

Here's my original script which I learned could only make individual parts become non-transparent and cancollide, not models, NPCs, or other things I had listed.

bob = script.Parent.Parent.Part

function onTouch(part)
bob.Transparency = 0
bob.CanCollide = true
end

script.Parent.Touched:connect(onTouch)

A solution, the user Time_URSS had given me, allowed me to pass this limit and make parts within models become fully visible and cancollide. This, however, did not include NPCs, and made it extremely difficult for being able to have the thing that I had explained - button-touch-events within button-touch-events. His code is as follows:

bob = script.Parent.Parent.Part

function onTouch(part)
    for k,v in pairs(bob:GetChildren()) do
        v.Transparency = 0
        v.CanCollide = true
    end
end

script.Parent.Touched:connect(onTouch)

Does anyone know a better way I can write this script to do as I want, or if I am stuck having to model within model within model within model with no NPCs and perhaps even unions? I know there is a way, through Event handling and other things (correct me if Im wrong), but I just don't know how to use them corresponding to scripts.

Thank you, and if needed I am fine with elaborating or clearing anything up.

tl;dr Is there a way I can have a button make a model visible and cancollide, consisting of NPCs, other buttons that can do the same jobs for other models, and unions? All without making a huge model within model within model cluster of things that after a while may end up being extremely hard to navigate through in studio?

0
Ha, read this like 4 times until I realized. Is this supposed to be like a standard tycoon? Player touches/purchases button which gives them new machines? xPolarium 1388 — 6y
0
If not I feel like it's the same concept. Most tycoons follow a button inside of the model/machine. When the player touches it you refer to the parent of the button which should be the model you want. You then use :GetChildren() to edit all but the button. xPolarium 1388 — 6y
0
The game Im trying to make is going to be based on a concept to the game of "Memories", where you expand the game by finding secret and invisible buttons. TitaneumCat 24 — 6y
0
Use :Connect(), :connect() is deprecated LoganboyInCO 150 — 6y

Answer this question