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

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

Asked by 6 years ago

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
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 lukeb50 631 — 6y

1 answer

Log in to vote
0
Answered by
adark 5487 Badge of Merit Moderation Voter Community Moderator
6 years ago

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.

0
This script is not in Localscript Bryson467 12 — 6y
Ad

Answer this question