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 cloned tool STAY in Backpack?

So I have a block, when you go through it, it clones a tool from replicated storage and puts it in the player's backpack

It all works, it's just when the player dies, it's not in the backpack anymore, and since it's in the past level they can't go back and re-retrieve it.

Here's the script for the part.

local buttonPressed = false


script.Parent.Touched:connect(function(hit)
	if not buttonPressed then
    
 
        buttonPressed = true
	if hit and hit.Parent and hit.Parent:FindFirstChild("Humanoid") then
		local Bucket = game.ReplicatedStorage["A Bucket of Water"]:Clone()
		local character = hit.Parent
		local player = game.Players:GetPlayerFromCharacter(character)
		
		Bucket.Parent = player.Backpack
		
		
	end
	        
	wait(10)
	buttonPressed = false

	end
	end)

1 answer

✓ Accepted answer

There is something named StarterGear in a player, and it clones them to the player's backpack every time they spawn. Therefore, add this:

Bucket:Clone().Parent = player.StarterGear

After line 14.

1 comment

0

THANK YOU! I NEVER KNEW ABOUT THAT! This will also help with a sword that you pick up near the end of the level. 2 problems solved! Thank you!

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