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

My script gives an error once it reaches "Multi" and doesn't save "Coins", can someone tell me why?

local players = game:GetService("Players")
local datastore = game:GetService("DataStoreService")
local ds1 = datastore:GetDataStore("CoinsValueSaver")
local ds2 = datastore:GetDataStore("MultiValueSaver")
local ds3 = datastore:GetDataStore("RebirthValueSaver")
local ds4 = datastore:GetChildren("UltraRebirthValueSaver")
local ds5 = datastore:GetChildren("PrestigeValueSaver")

players.PlayerAdded:connect(function(player)
	local folder = Instance.new("Folder")
	folder.Name = "leaderstats"
	folder.Parent = player
	
	local currency1 = Instance.new("IntValue")
	currency1.Name = "Coins"
	currency1.Parent = player.leaderstats
	currency1.Value = ds1:GetAsync(player.UserId) or 0
	ds1:SetAsync(player.UserId, currency1.Value)
	local currency2 = Instance.new("IntValue")
	
	currency2.Name = "Multi"
	currency2.Parent = player.leaderstats
	currency2.Value = ds2:GetAsync(player.UserId) or 0
	ds2:SetAsync(player.UserId, currency2.Value)
	local currency3 = Instance.new("IntValue")
	
	currency3.Name = "Rebirth"
	currency3.Parent = player.leaderstats
	currency3.Value = ds3:GetAsync(player.UserId) or 0
	ds3:SetAsync(player.UserId, currency3.Value)
	
	local currency4 = Instance.new("IntValue")
	currency4.Name = "UltraRebirth"
	currency4.Parent = player.leaderstats
	currency4.Value = ds4:GetAsync(player.UserId) or 0
	ds4:SetAsync(player.UserId, currency4.Value)
	
	local currency5 = Instance.new("IntValue")
	currency5.Name = "UltraRebirth"
	currency5.Parent = player.leaderstats
	currency5.Value = ds5:GetAsync(player.UserId) or 0
	ds5:SetAsync(player.UserId, currency5.Value)
	
	currency1.Changed:connect(function()
		ds1:SetAsync(player.UserId, currency1.Value)
	end)
	currency2.Changed:connect(function()
		ds2:SetAsync(player.UserId, currency2.Value)
	end)
	currency3.Changed:connect(function()
		ds3:SetAsync(player.UserId, currency3.Value)
	end)
	currency4.Changed:connect(function()
		ds4:SetAsync(player.UserId, currency4.Value)
	end)
	currency5.Changed:connect(function()
		ds5:SetAsync(player.UserId, currency5.Value)
	end)
end)

The errors I get when testing are: 17:53:03.589 - Multi is not a valid member of Folder 17:53:05.849 - 502: API Services rejected request with error. HTTP 403 (Forbidden) 17:53:08.039 - Rebirth is not a valid member of Folder 17:53:08.041 - UltraRebirth is not a valid member of Folder 17:53:08.042 - Prestige is not a valid member of Folder Thanks in advance!

1 answer

Hello.

Although I cannot fix the other scripts, (as you didn't show them to us) there's an easy fix for the DataStore one.

Just turn on API Services in the game settings. You don't even need a script.

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