You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
A saver for the equipped skin -
What is the issue? Include screenshots / videos if possible!
It just makes the value (EquippedSkin) the players name
script.RegisterBoughtItem.OnServerEvent:Connect(MakeValue)
script.EquippedSkinServerSide.OnServerEvent:Connect(function(plr, SelectedItem1)
print("sfdafasdfdgstflasodjkfasdljkflsjkadlsjk")
plr.PlayerGui.GarageUI.Information.EquippedSkin.Value = tostring(SelectedItem1)
print("fsd")
end)
^^ makes the equipped skin serverside
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) or "NoSkin"
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)
Save Script