Hi you all. I am a person who craves reusability and is constantly looking for a pain in the ass way to do something that will save me time later on.
I am trying to make a simple obby as a first project and I need a "Buy_part" for this. It is basically a part that the player touches to buy an assigned model in the form of [Trees, stairs, buildings, etc.] now I am not that experienced with Luau, yet! And I require the help of some of them nerd out here 🤭 (No offense intended)
I heard there is a way for the scripts to acces some sort of storage hold for models and spawn them in via this, maybe this is one of the things I will need to build an obby but I am not sure yet. Mainly I am looking to a way to make this "Buy_part" and being able to just put it into any model I want to make it act as a "Buyable".
Here are a way I came up with;
The script inside the Buy_part model will dig into the model its a child off and look for the IntValue part inside of it called "Price" to know how expensive the model is. Next it will connect the touhced signal and look for humanoid n all, not too hard, the hardest part is mainly for the script to know what its parent is.
I dont know of any ways to just acces the script's parent as doing game.workspace.[model_name].script will probably not work as I will be copying this buy_part model, script included, into many different models so they can act as a "Buyable" and this will break the path.
Can somebody explain to me how this is done? Is my current way of thinking the right conclusion? Or is there a better and easier way to make this happen?
(I'm an advanced GD-Script user so trying out Luau is a big step as I only know programmatic thinking in Luau)
** You are now Level 3! **