I'm looking for a script that when someone has brought something from my shop e.g. sword. Keeps it in there backpack forever even when they respawn.
My current shop script looks like this :
local player = game.Players.LocalPlayer
local currency = player:WaitForChild('leaderstats').Points
local amount = 50
local tool = game.ReplicatedStorage:WaitForChild('BlueKatana')
local indextext = script.Parent.Text
script.Parent.MouseButton1Click:connect(function()
if currency.Value >= amount and not player.Backpack:FindFirstChild('BlueKatana') or player.Character:FindFirstChild('BlueKatana') then
currency.Value = currency.Value - amount
local newtool = tool:Clone()
newtool.Parent = player.Backpack
else
script.Parent.Text = 'Purchase failed!'
wait(0.7)
script.Parent.Text = indextext
end
end)
script.Parent.MouseEnter:connect(function()
script.Parent.Parent.Parent.ProductImage.Image = 'rbxassetid://'..script.ImageValue.Value
script.Parent.Parent.Parent.Description.Text = script.DescValue.Value
script.Parent.Parent.Parent.ProductTitle.Text = script.TitleValue.Value
end)
script.Parent.MouseLeave:connect(function()
script.Parent.Parent.Parent.ProductImage.Image = 'rbxassetid://'
script.Parent.Parent.Parent.Description.Text = ''
script.Parent.Parent.Parent.ProductTitle.Text = ''
end)

1 comment
Data stores, wiki it