DataStore works on studio but not in game?

Hey, for some reason my datastore script for character customization works perfectly fine for me in studio, but not in-game. Anyone know why this is the case? The (server) script works by getting when the player joins and when their character is added. Below are pictures of what it looks like in studio vs. in-game.

EDIT: REDACTED SCRIPT

In studio -


In-game -

did u do a player removing function like setaync when the player leaves the game.

game.Players.PlayerRemoving:Connect (function(player)
    
   ds:SetAync(player.UserId.."Something", clothes) -- what ever is the code juzt an example.


end)

sorey for the bad explaination btw

do this on a phone! also add the function to the playeradded function.

Summary

This text will be hidden

it already has saved data @daulric

You should probably provide the script(s) you’re working with for better assistance.

done
onlythirtycharactersisokay

local d = data:GetDataStore("ClothingDataStore")

Nothing is done with d. There are no calls to GetAsync() or SetAsync().

there are, i removed them from the post… ill put them 1 sec

some parts of the scripts i removed (hence it says --redacted)

i put that back for you to see

as you can see here-


there is data for the user (me)

There’s still no SetAsync() call, which is required to store data in the datastore.

thats a different script

dataStore:SetAsync(player.UserId.."-asdjklasjdlkajs", game:GetService("HttpService"):JSONEncode(store))

JSONEncode() returns a JSON formatted string, when you subsequently load this data you need to call JSONDecode() on it to convert it back into Lua table format.

it is decoded i just didnt send that part

never mind, I fixed it by adding a wait(1) after the CharacterAdded function.

1 Like