#somebody mind helping me with a datastore script?

53 messages · Page 1 of 1 (latest)

forest bay
#

also I'm rather the 3d modeler and not really a pro scripter. I only know some casual scripts and how to change things in big scripts.

feral bloom
#

Actually, you can just do

local DataStoreService = game:GetService("DataStoreService")
local --ur data name-- = DataStoreService:GetDataStore("--ur data name--)

"game.Players.PlayerAdded:Connect(function(Player))
local leaderstat = Instance.new("Folder")
leaderstats.Name = "leaderstat"
leaderstat.Parent = Player

local Cash = Instance.new("Intvalue")
Cash.Name = "Cash"
Cash.Parent = leaderstat

local data
local success, errormessage = pcall(function()
data = --ur data name--:GetAsync(player.UserID.."Cash") --so the game can load the data--
end)

if success then
Cash.Value = data
else
warn(errormessage)
end
end)

#

and you do the same thing when a player leaves but with SetAsync

#

( game.Players.PlayerRemoving)

#

and --ur data name--:SetAsync(player.UserID.."Cash",player.leaderstats.Cash.Value)

#

hope that helped

#

GetAsync is to get the data, and SetAsync is to save the data, so do it for the two values that u want, and replace the --ur data name-- by the data name that u want

forest bay
#

umm ok

#

lemme try

forest bay
#

didn't work too

rustic spearBOT
#

studio** You are now Level 1! **studio

forest bay
#

@feral bloom try your own datastore script with those 2 values, give yourself some cash and miles, rejoin and see if it works for you, if it does, I'd like to know the script.

#

because I'm doing everything right but it still doesn't work

feral bloom
#

okay two seconds

#

okay letme try

#

i think iv made a mistake, leave me a litle bit of time , im trying to fix it

forest bay
#

maybe you haven't and you're encountering the same error 🤔

feral bloom
#

im looking for the error, im trying to do another method

#

got it

#

2 sec (letme re do the script)

forest bay
#

that would be such a huge help dude 🫠

#

my brain was literally melting when I was going through all those methods

feral bloom
#

i think its done

rustic spearBOT
#

studio** You are now Level 4! **studio

forest bay
#

cool

feral bloom
#

oh wait a litle bug of value

#

don't worry wont take too much time

rustic spearBOT
#

studio** You are now Level 2! **studio

feral bloom
#

Okkkk

#

iv managed to find a way to put two values

forest bay
#

great

feral bloom
#

and i think iv done a thing that is working lol

forest bay
#

lol

feral bloom
#

letme try to leave and rejoin to see if its saving

#

okay so that's weird

#

the thing is saving

#

but the miles got the same value as the coins

#

letme try to fix this rq

forest bay
#

I'm starting to think that roblox changed something for datastoring

#

because it feels way harder than before the big studio update

feral bloom
#

idk

#

dont worry i got this

forest bay
feral bloom
#

ok bro i'm sorry i don't lnow, iv done the script, it works for one value but the other value get the same value as the first each times i join

#

sorry, i hope someone better than me in datastore will find this

forest bay
#

ok just send me the code and I'll try to figure it out myself with my friend that can code too but only a little better than me

feral bloom
#

ok

#

iv tryed to do only one script but that wasnt working at all

#

have a nice day

forest bay
#

this might have fixed the problem