This script saves “b” as 0, instead of laptop. Any tips?
This is my first time posting on the dev forum.
local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("ToolSave")
game.Players.PlayerAdded:Connect(function(player)
game.ReplicatedFirst.warning:Clone().Parent = player.PlayerGui
local a = Instance.new("NumberValue",player)
a.Name = "lol"
a.Value = 0
local b = Instance.new("StringValue",player)
b.Name = "item"
b.Value = ds:GetAsync(player.UserId) or "laptop"
ds:SetAsync(player.UserId, b.Value)
b.Changed:connect(function()
ds:SetAsync(player.UserId, b.Value)
end)
end)
game.Players.PlayerRemoving:connect(function(player)
ds:SetAsync(player.UserId, player.item.Value)
end)