I have this game I'm trying to remake famous and this save script isn't working?It doesn't save data
Game: http://www.roblox.com/Galactic-Front-ALPHA-TELEPORT-GLITCH-PATCHED-place?id=178549718
Not Working Script:
debounce=false function Save() if debounce==false then debounce=true player=game.Players.LocalPlayer script.Parent.Text="Saving..." player:WaitForDataReady() player:SaveNumber("Credit", player.Credit.Value) inv=player:FindFirstChild("Inventory") for saveinv=1,8 do if inv~=nil then saveslot=inv:FindFirstChild("Slot"..saveinv) if saveslot~=nil then player:SaveString(("Slot"..saveinv), saveslot.Value) end end end wait(2) script.Parent.Text="Save" debounce=false end end script.Parent.MouseButton1Down:connect(Save)
1) I recommend using Data Stores, Data Persistence is outdated, here's the Data Store wiki page 2) You can't access Data Persistence or Data Stores through LocalScripts, you need a normal script.
Here's your revamped script:
local player = script.Parent.Parent.Parent.Parent.Parent.Parent --assuming this button is in a TextButton, in a ScreenGui, this is how to find player local creditSaves = game:GetService("DataStoreService"):GetDataStore("creditSaves") local invSaves = game:GetService("DataStoreService"):GetDataStore("invSaves") local credits = player.Credit.Value local inv = player:FindFirstChild("Inventory") local deb = false script.Parent.MouseButton1Click:connect(function() if not deb and player:WaitForDataReady() then deb = true script.Parent.Text = "Saving..." creditSaves:SetAsync(player.Name.." credits", credits) for saveInv = 1, 8 do if inv then saveSlot = inv:FindFirstChild("Slot"..saveInv) if saveSlot then invSaves:SetAsync(player.Name.." inventory", saveInv) end end end script.Parent.Text = "Save" end end)
That should work.