hi, i tried to make a save system for money in my game, but it doesnt want to load or save, ive made some prints to see if the script breaks or doesnt go further but it prints everything out, it also doesnt print out any errors in the output, ive enabled API access and im testing it in the game and not in studio just to make that clear.
Script (located in serverscriptservice)
local DSS = game:GetService("DataStoreService") local DStore = DSS:GetDataStore("BGPDStore") game.Players.PlayerAdded:Connect(function(player) local Folder = Instance.new("Folder", game.ReplicatedStorage.PlayerValues) Folder.Name = player.UserId local Money = Instance.new("IntValue", game.ReplicatedStorage.PlayerValues:FindFirstChild(player.UserId)) Money.Name = "Money" Money.Value = DStore:GetAsync(tostring(player.UserId)) print("PlayerData loaded and updated") end) game.Players.PlayerRemoving:Connect(function(player) print("player leaving") DStore:SetAsync(tostring(player.UserId), game.ReplicatedStorage.PlayerValues:FindFirstChild(player.UserId).Money.Value) print("player data saved") game.ReplicatedStorage.PlayerValues:FindFirstChild(player.UserId):Destroy() end)
Local script (located under a GUI in starter GUI)
plrGUI = script.Parent.Parent plrID = game.Players.LocalPlayer.UserId game.ReplicatedStorage.PlayerValues:FindFirstChild(plrID).Money.Changed:Connect(function() script.Parent.Frame.MoneyText.Text = "Money: "..game.ReplicatedStorage.PlayerValues:FindFirstChild(plrID).Money.Value end) script.Parent.Frame.ImageButton.MouseButton1Click:Connect(function() game.ReplicatedStorage.PlayerValues:FindFirstChild(plrID).Money.Value = game.ReplicatedStorage.PlayerValues:FindFirstChild(plrID).Money.Value + 5 end)