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

How do I make this script save in backpack even after resetting?

I have a script where it removes a previous script and replaces it with a new one but I can't figure out how to make it so the new one saves after resetting.

Here is the script:

local re = game.ReplicatedStorage.Green

re.OnServerEvent:Connect(function(player)
	for i, v in pairs(game.Players:GetChildren()) do
		v.Backpack.BeatSyncs:ClearAllChildren()	
	end
wait(0.1)
	for i, v in pairs(game.Players:GetChildren()) do
		local clubcolor= game.ServerStorage.BeatSyncClientGreen:Clone()
		clubcolor.Parent = v.Backpack.BeatSyncs
	end
end)

1 answer

A way you can do this is by having a script watching the players and if they die What you need to do is make the script you want in their back pack placed into the death watch script as its child then disable it and have the death watch script watch on the players death copy the script and then move the copy to the backpack and then enable it by turning disabled = false

Sorry there is no code wasn't too clear on how yours was set up but at least here is what would be needed for the death watch script

game.Players.PlayerAdded:connect(function(player)
	player.CharacterAdded:connect(function(character)
		repeat wait() until character.Humanoid
		character.Humanoid.Died:connect(function()

		end)
	end)
end)

1 comment

0

"repeat wait() until character.Humanoid" really? This will still error if the humanoid doesn't exist, and don't reinvent the wheel, just use :WaitForChild(), and :connect is deprecated infavour of :Connect

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