DataStore gives error

  1. What do you want to achieve? Keep it simple and clear!
    I want the server to save the equipped skin

  2. What is the issue? Include screenshots / videos if possible!

    I get this error message and i dont know how to fix it.

  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I did look on the forum but i couldn’t find an answer
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

local dataStoreCash = game:GetService("DataStoreService"):GetDataStore("MoneyData") -- Maakt de opslag aan voor de leaderstat
local dataStoreDiamonds = game:GetService("DataStoreService"):GetDataStore("DiamondsData")  -- Maakt de opslag aan voor de leaderstat
local dataStoreSkins1 = game:GetService("DataStoreService"):GetDataStore("SkinsData1")
local dataStoreSkins2 = game:GetService("DataStoreService"):GetDataStore("SkinsData2") 
local dataStoreSkins3 = game:GetService("DataStoreService"):GetDataStore("SkinsData3") 
local dataStoreSkins4 = game:GetService("DataStoreService"):GetDataStore("SkinsData4") -- Maakt de opslag aan voor items die je hebt gekocht (garage)
local EquippedSkinStore = game:GetService("DataStoreService"):GetDataStore("EquippedSkin")

starterCash = 0
starterDiamonds = 0
starterValue = false
starterSkin = ""

    local Gradient1 = "Gradient1"
	local Gradient2 = "Gradient2"
	local Gradient3 = "Gradient3"
	local Gradient4 = "Gradient4"
	local GarageSled = game.Workspace:WaitForChild("GarageSled")
	local leaderstats ="Folder") -- Maakt een map voor de leaderstats
	leaderstats.Name = "leaderstats" -- maakt de naam voor de leaderstats
	leaderstats.Parent = plr -- staat waar de leaderstats zijn

	local money ="IntValue")
	money.Name = "Coins"
	money.Value =  dataStoreCash:GetAsync(plr.UserId) or starterCash
	money.Parent = leaderstats
	local Diamonds ="IntValue")
	Diamonds.Parent = leaderstats
	Diamonds.Name = "Diamonds"
	Diamonds.Value =  dataStoreDiamonds:GetAsync(plr.UserId) or starterDiamonds
	local OwnedSkins ="Folder") -- Maakt een map voor de skins
	OwnedSkins.Name = "OwnedSkins" -- maakt de naam voor de skins
	OwnedSkins.Parent = plr -- staat waar de skins zijn
	local EquippedSkin = plr:WaitForChild("PlayerGui"):WaitForChild("GarageUI").Information.EquippedSkin
	EquippedSkin.Name = "EquippedSkin"
	EquippedSkin.Parent = plr:WaitForChild("PlayerGui"):WaitForChild("GarageUI").Information
	EquippedSkin.Value = EquippedSkinStore:GetAsync(plr.UserId) -- i wanna load it here
	local Gradient1 ="BoolValue")
	Gradient1.Name = "Gradient1"
	Gradient1.Parent = OwnedSkins
	Gradient1.Value = dataStoreSkins1:GetAsync(plr.UserId) or false
	local Gradient2 ="BoolValue")
	Gradient2.Name = "Gradient2"
	Gradient2.Parent = OwnedSkins
	Gradient2.Value = dataStoreSkins2:GetAsync(plr.UserId) or false
	local Gradient3 ="BoolValue")
	Gradient3.Name = "Gradient3"
	Gradient3.Parent = OwnedSkins 
	Gradient3.Value = dataStoreSkins3:GetAsync(plr.UserId) or false
	local Gradient4 ="BoolValue")
	Gradient4.Name = "Gradient4"
	Gradient4.Parent = OwnedSkins
	Gradient4.Value = dataStoreSkins4:GetAsync(plr.UserId) or false

	local OwnedSkins = plr:WaitForChild("OwnedSkins")
	dataStoreCash:SetAsync(plr.UserId, plr.leaderstats.Coins.Value) -- slaat de data op als de player uit de game gaat
	dataStoreDiamonds:SetAsync(plr.UserId, plr.leaderstats.Diamonds.Value) -- slaat de data op als de player uit de game gaat
	dataStoreSkins1:SetAsync(plr.UserId, plr.OwnedSkins:WaitForChild("Gradient1").Value)
	dataStoreSkins2:SetAsync(plr.UserId, plr.OwnedSkins:WaitForChild("Gradient2").Value)
	dataStoreSkins3:SetAsync(plr.UserId, plr.OwnedSkins:WaitForChild("Gradient3").Value)
	dataStoreSkins4:SetAsync(plr.UserId, plr.OwnedSkins:WaitForChild("Gradient4").Value)
	EquippedSkinStore:SetAsync(plr.UserId, plr:WaitForChild("PlayerGui"):WaitForChild("GarageUI").Information.EquippedSkin.Value)

What line exactly is line 41? (chars moment)

EquippedSkin.Value = EquippedSkinStore:GetAsync(plr.UserId) this one

That’s weird. Well, I got no idea what’s wrong. Consider using pcalls when getting/setting to datastores, though.

As you have done for the other values I recommend that you include a fail check (in case no value is loaded) otherwise you’ll be attempting to assign “nil” to a value instance.

EquippedSkin.Value = EquippedSkinStore:GetAsync(plr.UserId) or false

Its not a boolvalue so that doesn’t work

What value type is it? GetAsync() will return nil if the specified key doesn’t exist. If it’s a string you can use an empty string, a number value then you can use 0 etc.

EquippedSkinStore:GetAsync(plr.UserId) or EquippedSkin.Value == false

try this?

It’s a stringvalue and not a boolvalue

EquippedSkinStore:GetAsync(plr.UserId) or EquippedSkin.Value == ""

Use an empty string to represent no value.