So I have been working on a game that is going to HEAVILY rely on data stores and it won't work. I have actually scrapped a project because of this and its making me so frustrated. Please help, add your username below so I can friend you and add you to the game, I just so dearly want this to work. So what we are focused on are CPods (capture pods) just as a test I added them and made a button click to add CPods. To make sure im clear, I meant to SET the Cpods as 5 not add, and when I click it and leave, it reverts back to its default (0)
CPods and datastore script
local DataStore = game:GetService("DataStoreService")
local ds = DataStore:GetDataStore("CashSaveSystem")
game.Players.PlayerAdded:connect(function(player)
leader = Instance.new("Folder",player)
leader.Name = "leaderstats"
local CPods = Instance.new("IntValue",leader)
CPods.Name = "CPods"
CPods.Value = ds:GetAsync(player.UserId) or 0
ds:SetAsync(player.UserId, CPods.Value)
CPods.Changed:connect(function()
ds:SetAsync(player.UserId, CPods.Value)
end)
end)
game.Players.PlayerRemoving:connect(function(player)
ds:SetAsync(player.UserId, player,leader.CPods.Value)
end)
The script that sets the cpods as 5
Intro = script.Parent.Parent.controlFrame.Intro
Info = script.Parent.Parent.info.TextLabel
local Player = game.Players.LocalPlayer
local CPods = Player:WaitForChild('leaderstats'):WaitForChild('CPods')
script.Parent.MouseButton1Click:Connect(function()
if Intro.Info.Text == ">Info" then
Info.Text = "Press start to begin your adventure"
else
CPods.Value = 5
end
end)

3 comments
is the first script a normal script? or local? If its a normal script, the problem is that the value is only changing to the client
There isn’t a third argument to :SetAsync(). Only the DataKey and it’s affiliated Data. Remove the ‘,’—which I assume is a mistake—and replace it with the intended dot operand (line 18.)
which script?