I get this error message and i dont know how to fix it.
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 = ""
game.Players.PlayerAdded:Connect(function(plr)
local Gradient1 = "Gradient1"
local Gradient2 = "Gradient2"
local Gradient3 = "Gradient3"
local Gradient4 = "Gradient4"
local GarageSled = game.Workspace:WaitForChild("GarageSled")
local leaderstats = Instance.new("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 = Instance.new("IntValue")
money.Name = "Coins"
money.Value = dataStoreCash:GetAsync(plr.UserId) or starterCash
money.Parent = leaderstats
local Diamonds = Instance.new("IntValue")
Diamonds.Parent = leaderstats
Diamonds.Name = "Diamonds"
Diamonds.Value = dataStoreDiamonds:GetAsync(plr.UserId) or starterDiamonds
local OwnedSkins = Instance.new("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 = Instance.new("BoolValue")
Gradient1.Name = "Gradient1"
Gradient1.Parent = OwnedSkins
Gradient1.Value = dataStoreSkins1:GetAsync(plr.UserId) or false
local Gradient2 = Instance.new("BoolValue")
Gradient2.Name = "Gradient2"
Gradient2.Parent = OwnedSkins
Gradient2.Value = dataStoreSkins2:GetAsync(plr.UserId) or false
local Gradient3 = Instance.new("BoolValue")
Gradient3.Name = "Gradient3"
Gradient3.Parent = OwnedSkins
Gradient3.Value = dataStoreSkins3:GetAsync(plr.UserId) or false
local Gradient4 = Instance.new("BoolValue")
Gradient4.Name = "Gradient4"
Gradient4.Parent = OwnedSkins
Gradient4.Value = dataStoreSkins4:GetAsync(plr.UserId) or false
end)
game.Players.PlayerRemoving:Connect(function(plr)
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)
end)
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
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.