Best way to temporarily store data

Let’s say I got a tier called “Homeless”, I would like to temporarily store that tier data into the player. And remove the tier from the player’s data after leaving the game or after a certain condition is met.

i don’t know much about roblox API so please help me :slight_smile:


I would say the easiest way to do this would to create a BoolValue or StringValue inside StarterGui then you can easily toggle the value on and off through scripts


Is MemoryStoreService a better technique to temporarily save player’s data according to my scenario listed in the post?

Since you don’t need the data to be saved after leaving, just creating a bool or number value in the player is the best way. Memory store and data stores are both for saving data outside of a server. If the data not always disappears after leaving then I would consider using data stores, as I believe memory stores have a time limit.

1 Like

How safe is storing the bool/number value inside the player is? can exploiters change it’s value?

If you’re setting it from the client: absolutely.

If you’re setting it from the server, and you’re storing it as an attribute on the player, or in a Value Instance (e.g. BoolValue): No, the exploiter can’t edit it’s value server-side, but they can view it, and edit it client-side.

1 Like

You can set an Attribute onto the Player to keep track of it! Attributes are always my go-to for such use cases instead of Instances (NumberValues etc) unless I need to store an Instance (Which you can use ObjectValues for!)
To save it from being exploited, I would suggest Setting and Getting the attribute on the server instead of the client!
For Storing something like Tiers you can simply do

player:SetAttribute("Tier", "Homeless")

and later whenever you need to check this,

1 Like

Thanks! I’ll look into this. Is this a way more unexploitable than using values but we are setting the value using server script? I do think that using values is easier but if this is a better choice. Then I’ll do this one instead

(I am creating the value inside the server script too btw)

Here is an example

	local CloneNPC = NPC:Clone()
	CloneNPC.Name = selected
	CloneNPC.Parent = game.workspace
	CloneNPC.HumanoidRootPart.Position =, 0, -10.1)
	player:WaitForChild("NPC_AMOUNT").Value = true

Ooops wrong code.

This is how i create the value

	local NPC_AMOUNT ="BoolValue")
	NPC_AMOUNT.Value = false
	NPC_AMOUNT.Parent = player

Attributes are similar to Values in many Ways (They both can be exploited if on the client-side) (Attributes are much more optimized). Thank you for providing Code, That should be perfectly fine if you want to use a BoolValue. However, if you want to do the same using Attributes, you would do

        player:SetAttribute("NPC_AMOUNT", false)

Which would essentially do the same thing but should be easier to manage and more optimized!

As I said before, if Exploitation is your concern then You should just make sure that these values are set and gotten on the server OR you have extra checks on anything that you want to do. If you want to use attributes on the client (Get them), I would suggest firing a remote-event that has a server-sided confirmation of if the Attribute is what you wanted it to be (Like a little if statement that breaks the loop if the condition is not met)!


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.