I can't quite figure out what to do in order to clone an object in the ServerStorage from what is inputted from a textbox. (Note - what is in the text box is Glock and what is in ServerStorage is also Glock)

I've Tried:

							local SecondaryName = v.Weapons.Secondary.Text
							local Secondary = game.ServerStorage.Weapons.Secondary .. SecondaryName:Clone()
							Secondary.Parent = v.Backpack

Another I've tried:

							local SecondaryName = v.Weapons.Secondary.Text
							local Secondary = game.ServerStorage.Weapons.Secondary.SecondaryName:Clone()
							Secondary.Parent = v.Backpack

I keep getting errors stating that this isn't a path of the object. What would I need to do for the Server to give me an item in ServerStorage that has the same name as what is in the textbox?

3 comments

1

local Secondary = game.ServerStorage.Weapons.Secondary[SecondaryName]:Clone(). Also note that local scripts cannot access ServerStorage. if you're trying to do this, you'll have to use a remote event (or a remote function, depending on what your endgoal is)

1

It's a server script and the text is sent to it

1

Works thanks