You can write your topic however you want, but you need to answer these questions:
- What do you want to achieve? Keep it simple and clear!
I’m currently working on a drawing game and I would like players to be able to report inappropriate drawings. I have two places that exist under the same game. The first place is where all the gameplay occurs, and the second place is “staff lounge” where a mod of my game can review reported drawings. I would like a mod to be able to fetch all the drawings reported from a datastore and review them manually so that he or she can determine if the reported artist should be banned from the game or not.
- What is the issue? Include screenshots / videos if possible!
As of now, I store the drawing data within a table that includes the size, position, color, etc. of the pixels of the drawing so that the drawing can later be reproduced when it’s time to be reviewed. When I save the drawing data to the datastore, the key is the UserId of the artist that is being reported. What I am not sure of is how to allow a mod of my game to receive the drawing data of the reported artist. I assume that I would need to use :GetAsync(), but the mod has no way of knowing what the UserId of the reported artist is, so I suppose I would need to use a different key.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I searched the Developer Hub about something similar to my problem, and all I could seem to find was that it is not possible to iterate through a datastore. I’m not sure why I would need to iterate through it though, as it should be as simple as using :GetAsync(). What I plan on doing is that when a mod first joins the mod lounge, the game will fetch a reported drawing and display it on the mod’s screen where he or she can determine if the artist should be banned. The thing I am not sure about is how to implement
:GetAsync() so that the mod can retrieve a reported drawing. i hope that makes sense.
Here is some sample code of what happens when a player reports a drawing:
--main game
local DS = game:GetService("DataStoreService")
local ReportedDrawingsStore = DS:GetDataStore("ReportedDrawings")
local success,errormessage = pcall(function()
ReportedDrawingsStore:SetAsync(artist.UserId,drawingData)
end)
This is what I’m not sure of how to implement:
--mod lounge
local GroupID = 4226010
local GroupRank = 252
local DS = game:GetService("DataStoreService")
local ReportedDrawingsStore = DS:GetDataStore("ReportedDrawings")
game.Players.PlayerAdded:Connect(function(player)
if player:GetRankInGroup(GroupID) < GroupRank then
player:Kick("You lack the power to enter this place.") -- i only want mods to join the mod lounge
end
local success,errormessage = pcall(function()
ReportedDrawingsStore:GetAsync(???)
--this i am not sure of because the mod has no way of knowing the user id of the reported artist
--perhaps i would need to use a different key?
--eventually i want all reported drawings to be reviewed and then eventually removed from the datastore once reviewed
end)
end)
Ultimately, I would like the reported artist to view the drawing that got him or her banned when he or she tries to join the main game. Thank you for your help