-
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.
-
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.’ -
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!