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

Saving this table using DataSave is deciding not to work, anyone know why?

I honestly have no clue why this isn't working. The loading part of the script (not here) works fine, it just won't save the table.

game.Players.PlayerAdded:Connect(function(player)
	local data
	local sucess, errormessage = pcall(function()
		data = eqSave:GetAsync(player.UserId.."-Equip")
		print(data.equip)
		if data then
			print("AtIF")
			local Folder = Instance.new("Folder",player)
			Folder.Parent = player
			Folder.Name = "equipped"
			for i, v in pairs(data.equip) do
				game.ReplicatedStorage.Gear:WaitForChild(v.nameValue)
				print(v.nameValue)
				if game.ReplicatedStorage.Gear:FindFirstChild(v.nameValue) then
					local BPK = player.BPK
					local invalue = #BPK:GetChildren()
					local tool = game.ReplicatedStorage.Gear[v.nameValue]:Clone()
					tool.Parent = player:WaitForChild("equipped")
					tool.Name = v.Name..invalue
					tool.Damage.Value = v.Damage
					tool.Rarity.Value = v.Rarity
					tool.Type.Value = v.Type
					tool.Description.Value = v.Description
					tool.MinLevel.Value = v.MinLevel
					tool.Equippted.Value = v.Equippted
					tool.nameValue.Value = v.nameValue

2 comments

0

Found out the problem wasn't saving the code, but loading it. It will get the table perfectly fine but won't clone the object I want it to. I will change the post to show that.

0

It worked for a second and then stopped working after I got rid of a print line for debugging. I think it is a problem with timing. I will see.

1 answer

It seems that everything worked, but the script was crashing and not going forward. I don't know why it happened but I gave it a wait and it seems to work now.

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