So the player will purchase an item from the shop, which needs to be given to the player in such a way that it will stay in the backpack, even if they reset.
Backpack doesn't work, because it resets when the player dies.
Also, StarterGear doesn't work, because then every player will get the item.
I'm stumped...
Here's my code (temporarily using the Backpack):
leaderstats = game.Players.LocalPlayer:WaitForChild("leaderstats")
function onClickEvent()
print(game.Players.LocalPlayer.Name.." is attempting a purchase.")
if leaderstats.Tokens.Value < 0 then
print("Not enough tokens!")
script.Error:Play()
else
print("Ok!")
leaderstats.Tokens.Value = leaderstats.Tokens.Value - 1500
local purchasedItem = game.ReplicatedStorage.Items.ClassicLauncher:Clone()
purchasedItem.Parent = game.Players.LocalPlayer:WaitForChild("Backpack")
end
end
script.Parent.MouseButton1Click:Connect(onClickEvent)

1 comment
This answer just needs to extend in knowing which player owns which items.