iceedfr
(King)
#1
Hi guys. How would i go about creating a datastore to for something like pets but the pets can have different variables.
For example:
You have a Cat that does 45 damage which is named Bob and a Cat that does 43 damage which is named Joe.
How would i go about saving that the cat does that much amount of damage and is named the name.
Any YouTube videos or DevForum posts would help.
gertkeno
(Gert)
#2
You could store each variable as part of a table
local player_pet_save = {
name = pet:FindFirstChild("Name").Value
damage = pet:FindFirstChild("Damage").Value
}
datastore:SetAsync("Pet" .. player.UserId, player_pet_save)
This is a good forum post on how to use datastores.