I'm trying to make a shop in my game (NO DataStores), where players can buy items using the in-game money (Galleons) they have - Which is earned by the amount of time they play the game.
However, when trying to purchase an item I keep receiving the same error and I can't find a way around it.
Please can someone help?
game.ReplicatedStorage.Potions.OnServerEvent:Connect(function(player,BuyButton)
if BuyButton == "Buy" then
"I have been pressed" -- Checking the remote actually picks up, which it does!
for _, child in pairs(player.PlayerGui.ShopGui.Frame.PotionsList:GetChildren()) do
if child.Name == "Death" and child.IWant.Value == true
then
if player.leaderstats.Galleons >= 50 then
A = game.ServerScriptService.Potions.DeathPotion
B = A:clone()
B.Parent = player.Backpack
player.leaderstats.Galleons = player.leaderstats.Galleons - 50
elseif child.Name == "Death" and child.IWant.Value == true then
if player.leaderstats.Galleons <= 50 then
end
print("Not enough.")
end
end
end
end
end)
Thanks.

1 comment
The error tells you what line. Userdata = Instance or Roblox data. deduce it yourself.