I have a game where players are able to buy a weapon. The players originally spawn with the correct default weapon, however, once a player buys a weapon all the people get that weapon.
The script that saves whether a person owns an item:
local datastoreservice = game:GetService("DataStoreService")
local itemStore = datastoreservice:GetDataStore("ItemStore")
local function plrJoin(plr)
print("Loading "..plr.Name.."'s items")
wait(1)
pcall(function()
plr.PlayerGui.Main.Shop.ItemFrame.LaserGun2.Bought.Value = itemStore:GetAsync(plr)
end)
while wait(60) do
print("Saving "..plr.Name.."'s items")
pcall(function()
itemStore:SetAsync(plr, plr.PlayerGui.Main.Shop.ItemFrame.LaserGun2.Bought.Value)
end)
end
end
game:GetService("Players").PlayerAdded:Connect(plrJoin)
The script that gives the item to the player in the game:
for i = 1, #plrs do
if plrs[i].PlayerGui.Main.Shop.ItemFrame.LaserGun2.Bought.Value == true then
wep = game.ReplicatedStorage.toolsToBeGiven.LaserGun2
wep:Clone().Parent = plrs[i].Character
else
wep = game.ReplicatedStorage.toolsToBeGiven.LaserGun
wep:Clone().Parent = plrs[i].Character
end
end

2 comments
Is the bought value a stringvalue?
The bought value is a boolean value.