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

How to save a bought gear from GUI shop after death?

Hello again! I’ve created a GUI shop with gears that player can buy with money (not R$). But if a player who bought the gear dies, he will lose it. I don’t want to make player work for money again and again. The script after buy button is pressed is

game.ReplicatedStorage.ToolEvents.DroneEvent.OnServerEvent:Connect(function(player)
	if player.leaderstats.Money.Value >= 500 then
		player.leaderstats.Money.Value = player.leaderstats.Money.Value - 500
		game.ServerStorage.Tools.SpyDrone:Clone().Parent = player.Backpack
	end
end)

I was creating tool events to make their function stay. As you see after the tool is bought its cloned to player's backpack. I'm a big rookie in scripting, so I hope you will help. Also, thanks!

2 answers

✓ Accepted answer

You would want to also clone another spydrone to the player's StarterGear which would give the player the spydrone after death

Now, this does not solve your question IF you want it to save when the player leaves the game

game.ReplicatedStorage.ToolEvents.DroneEvent.OnServerEvent:Connect(function(player)
    if player.leaderstats.Money.Value >= 500 then
        player.leaderstats.Money.Value = player.leaderstats.Money.Value - 500
        game.ServerStorage.Tools.SpyDrone:Clone().Parent = player.Backpack
	game.ServerStorage.Tools.SpyDrone:Clone().Parent = player.StarterGear
    end
end)

1 comment

0

Tysm! This answer is the one I was dreaming about!

Create a Boolvalue named after every gear and parent it to a Folder in every Player that joins and when the gear is bought the BoolValue is set to true and if the Player dies then the server will check if the BoolValue is true. (Keep in mind scriptinghelpers.org is NOT a request site, that is one of the reasons I didn't provide code)

2 comments

0

Can you tell me how to make boolvalue in my case, please? And what do I need to do to make my question not a request? Ty

0

Do Instance.new("BoolValue")

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