I have a GUI that sells a t-shirt and gives the player a tool if they buy/own the shirt
In one of the buttons, I've put in this LocalScript:
id = 826251512
player = game.Players.LocalPlayer
a = game.ServerStorage.Tool
b = a:Clone()
owned = (
game:GetService('BadgeService'):UserHasBadge(player.userId, id)
)
function givetool()
if player ~= nil then
local tool = b:Clone()
tool.Parent = player.Backpack
end
end
script.Parent.MouseButton1Click:connect(function()
if not owned then
game:GetService("MarketplaceService"):PromptPurchase(player, id)
elseif owned then
givetool()
end
end)
For reference, I guess:
- A tool is located in ServerStorage called "Tool" -The GUI is given to the player when they touch a brick (this part works)
In game, when I click the button it's supposed to:
- Check if the player owns the Item then
- Give the player the tool
However, in the game,
- The GUI doesn't do anything when clicked
- I get this in the Client Log: "ServerStorage is not a valid member of DataModel"
Help?
(I'm fairly new at trying more complicated scripts so if you could explain where I went wrong and why that'd be amazing)

1 comment
Thanks for your help!