Issues with profile service

  1. What do you want to achieve?
    I am trying to make a car number plate profile store utilizing the profile service. After looking at the Profile Service API I am unsure at how and what syntax I should use to 1. Save/load/edit profiles without attaching a player or userid to them 2. Check keys in the specific store so when I add a new number plate it is unique to all the others.

Ideally, when a new number plate is generated it should check firstly that it doesnt already exist in the store then secondly, be created as as new profile store data from the remote function and then returning the name of the plate back to where the function was invoked.

  1. What is the issue?
    So far I have experienced errors such as:
    ‘KeyNotFound: The requested key does not exist. API: ListVersionsAsync, Data Store: NumberPlateStore1’
    ‘Version query fail - 502: API Services rejected request with error. Error code: 11 Reason: The requested key does not exist.’

  2. What solutions have you tried so far?
    I have searched videos and other forums of this issue and there is not much information on saving data using profile service that isnt attached to userid’s.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

function NumberPlateFunctionServer(p, data, extras)

	if data then
		if data[1] == 'Add' then
			if data[4] == 'XX-99-XX' then
				local plate = 'DI'..math.random(0,9)..math.random(0,9)..alphabet[math.random(1,#alphabet)]..alphabet[math.random(1,#alphabet)]
				local query = (profilestorage:ProfileVersionQuery(plate):NextAsync())
				if query ~= nil then
					repeat
						plate = 'DI'..math.random(0,9)..math.random(0,9)..alphabet[math.random(1,#alphabet)]..alphabet[math.random(1,#alphabet)]
						query = (profilestorage:ProfileVersionQuery(plate):NextAsync())
					until (profilestorage:ProfileVersionQuery(plate):NextAsync()) == nil
				end
				
				local profile = profilestorage:LoadProfileAsync(plate)
				profile.Data.Owner = data[2]
				profile.Data.Car = data[3]
				profile.Data.Colour = game.ReplicatedStorage.Cars[extras][data[3]].VALUES.Colour.Value
				
			end
		elseif data[1] == 'Check' then
			
			
		end
	end
end

Any help would be appreciated!

I think you’ll want to make a data handler module, like in this video at 4:40 https://www.youtube.com/watch?v=qX62XC6SUKg

Apologies if it is worded weirdly, basically, I want to make a profile store that stores car number plates (e.g PLT_123 etc) as the key to the store. these keys contain info about the car such as the owner, colour, and car model. Naturally, as people buy a car in my game, the car number plate has to be unique to any other plates stored before and the profile cannot be saved to the player (due to the fact I need to ‘check’ the profile stores keys to see if it is unique when creating a new plate). I am also confused on how I would go about ‘checking’ a profile store so see if a randomly generated key has been generated previously to avoid double ups.

1 Like

Saving and loading data shouldn’t occur when a player joins and leaves, but should be ‘checked’ when a new car is bought.

1 Like