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

How to make the tool stay in my inventory, even if I die/reset but not when I leave the game?

Cause after 60 minutes, I get the 'MiniPan' and If I die/reset it just leaves my inventory, which I want it to stay in. Though It can leave my inventory when I exit the game and rejoin. Can anyone help? I'm not sure where to start/how to script this.

local price = 60
local db = true

script.Parent.ClickDetector.MouseClick:connect(function(player)
	if player.leaderstats.Minutes.Value >= price then
		player.leaderstats.Minutes.Value = player.leaderstats.Minutes.Value - price
		db = false
		game.ReplicatedStorage.MiniPan:Clone().Parent = player.Backpack
		wait (3)
		script.Parent.BrickColor = BrickColor.new("Institutional white")
		db = true
	end
end)[](http://)

4 comments

0

Does the script have to be a whole new script for the tool itself? if so what would that look like?

1

Do StarterGear after you clone the tool to the player's backpack.

0

you could do player.Character.Humanoid.Died:connect(function() and destroy the tool here end) but idk how to make it save when you leave

0

Well, you can do what @Davydas1118 has suggested. if you don't understand, let me simplify it to you. Basically, you might have heard of StarterPack, which clones the tool to the player's backpack on spawn, and respawn. So, basically, he is trying to say, that you create two clones of your tool. Parent the first clone to the player's backpack and second clone to the StarterPack.

1 answer

✓ Accepted answer

Well instead of putting Player.BackPack Put Player.StarterGear it acts like a Mini Starterpack, only until you leave the server.

Here is the entire code:

local price = 60
local db = true

script.Parent.ClickDetector.MouseClick:connect(function(player)
	if player.leaderstats.Minutes.Value >= price then
		local plr = game.Players:findFirstChild(player.Name)
		player.leaderstats.Minutes.Value = player.leaderstats.Minutes.Value - price
		db = false
		game.ReplicatedStorage.MiniPan:Clone().Parent = player.StarterGear
		wait (3)
		script.Parent.BrickColor = BrickColor.new("Institutional white")
		db = true
	end
end)

1 comment

0

Thankyou!

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