Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Looking for a script!?!

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

1

Data stores, wiki it

2 answers

✓ Accepted answer

You would need to use Data Stores To save the players items upon/before death or even when they leave the game. Data Stores Could also be used to save any stats that the player might have. I would highly suggest looking at the Roblox Wiki or some online tutorials. Good luck! (-:

You would have to use a kind of "Data" Storing.

I'd suggest looking at ToolPersistence.

2 comments

4

I don't believe that ToolPersistence is a term. If you're talking about Data Persistence, that is depreciated and Data Stores are what should be used to save any data.

3

I also wouldn't recommend Data Persistence because it's deprecated.

This discussion is preserved as it was. New answers, comments, and votes are closed.