Hi,
I have a bunch of parts that when touched get cloned into a model that represent the part.Name that they touched. They are all different part.Names and Models.
I want to use a common script, that pulls the part.Name of the part that was touched, then defines a second variable that is the location of the correct model.
(I do not really want to set up a lookup table because that defeats making it portable to other parts)
The only help I need is the correct syntax to use to define the 2nd variable.
For example:
eggname = script.Parent.Name
(which is a part that they touch) which output shows = ’ 12:13:39.200 eggname part name is GreenGood ’ or GreenGood
So this works fine and is a string
The name of the model is the 2nd variable is
local pet = game.ReplicatedStorage.Pets.eggname
(which is the model I am going to clone but it needs to be correct syntax) Note it is a model, not just like the one part that they touched.
But I need to change the end ‘eggname’ to the correct syntax for a variable instance of the model so then pet would equal ‘game.ReplicatedStorage.Pets.GreenGood’
The thing is , eggname is a string and I am trying to combine it to define pet as a model in ‘game.ReplicatedStorage.Pets.GreenGood’
If i try something like this
local whereisit = game.ReplicatedStorage.Pets
local pet = whereisit…eggname
I get the error attempt to concatenate Instance with string
Is there a way to combine this so it works as an instance ?