Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Game Can't find the model in serverstorage, how do I make it find the item name?

Error: 21:46:16.290 - Bronze Sword is not a valid member of Model Attempts: I have been changing how to find the item Whats needed: I am wanting it to find the item thats the name of the TextLabel in the ServerStorage and clone it and put it in there backpack when they have enough Gold

function BuyItem(player)
	if script.Parent.TextButton.Text == 'BUY NOW!' then
		if script.Parent.Parent.Parent.Parent.Parent.Parent.leaderstats.Gold.Value >= script.Parent.ForBuyCost.Value then
			print("Has Money")
			local toolca = game.ReplicatedStorage.ITEMS(script.Parent.ObjName.Text):Clone()
			local toolcb = game.ReplicatedStorage.ITEMS(script.Parent.ObjName.Text):Clone()
			toolca.Parent = script.Parent.Parent.Parent.Parent.Backpack
			toolcb.Parent = script.Parent.Parent.Parent.Parent.StarterGear
			local bc = BrickColor.new("Bright red")
			game.StarterGui:SetCore("ChatMakeSystemMessage", {
				Text = "[SYSTEM] "..player.Name.." PURCHASED"..script.Parent.ObjName.Text;
				Font = Enum.Font.Cartoon;
				Color = bc.Color;
				FontSize = Enum.FontSize.Size96;
			})
			
		end
	else
		print("PLAYER IS POOR")
	end
end

1 comment

2

This error means that the item with the name cannot be found in the location. You may be searching the wrong location or the name may not be correct. They are case-sensitive. Not much we can help with

1 answer

Since this is GUI code, I assume you're using a LocalScript. ServerStorage is not replicated to Clients. Your best bet here is firing a RemoteEvent and having a server-sided Script give the Player their item.

1 comment

0

This script is not in Localscript

This discussion is preserved as it was. New answers, comments, and votes are closed.