Upgrading A Table Value

I have a Table With A Value For Every Player And I Wanna Upgrade it In Anyway

My Biggest Issue With My Current Table Is.
let’s say I wanna change the value of “Katana” to true it would change but… here comes the issue
When the player dies or Reset The Value Would Go Back To The Old One (The Original One)
And I really got no Idea How Im Suppose To Upgrade It Because Im A Big Fan Of Games Like “Deepwoken” and I’m sure They Use A Method That they Could Use The Value In Any Script Soo If Anyone Knows A Way To Upgrade Or Has Another Way Of Doing It
I would Really Appreciate it

Table Script
local t = {}

for i, c in pairs(workspace:GetChildren()) do
	wait()
	local h = c:FindFirstChild("Humanoid")
	if h then
		if c.Parent ~= workspace.Npc then
			t[c.Name] = {
				Stun = false,
				Attack = false,
				Block = false,
				PerfectBlock = false,
				Dash = false,
				cd = false,
				cd1 = false,
				cd2 = false,
				Katana = true,
				Scythe = false,
				Equipped = false,
			}
		end
	end
end

workspace.ChildAdded:Connect(function(c)
	wait()
	local h = c:FindFirstChild("Humanoid")
	if h then
		t[c.Name] = {
			Stun = false,
			Attack = false,
			Block = false,
			PerfectBlock = false,
			Dash = false,
			cd = false,
			cd1 = false,
			cd2 = false,
			Katana = true,
			Scythe = false,
			Equipped = false,
		}
	end
end)


workspace.ChildRemoved:Connect(function(c)
	local h = c:FindFirstChild("Humanoid")
	if h then
		t[c.Name] = nil
	end

end)


return t

Note: Keep In Mind The “ChildAdded” Section Is The Original One.

1 Like

Whenever required from another script, moduleScripts/table scripts reset their values. in order to save them, I recommend creating BoolValues or other Value Instances in order to be able to change them from anywhere and then saving them in a corresponding script for saving data.

What is a “corresponding script”?

A server script, or you can use a moduleScript and then require it in a server script.

You can save them by setting setting table keys to their values and then saving the table using the DatastoreService, ProfileService, or Datastore2.

but the values that i need to use is in a local script and not a server script

do you have any Youtube Videos That you Recommend that Explain it more?