Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Is it possible to remove a certain key from data store?

Asked by 6 years ago

Hello.

I have a ban system in my game that uses data store. Is it possible to unban a person from the data store without un banning everyone else?

Code I have (it is part of an admin commands system)

elseif msg:lower():sub(1,4) == ";ban" then
                local obj = msg:sub(6)
                local player = game.Players[obj]
                local ds = game:GetService("DataStoreService"):GetDataStore("Moderation") 
                    ds:SetAsync(player.UserId, true)
                    wait()
                game.Players[obj]:Kick("You have been banned!")

Thanks

0
Just make a command that sets their datastore to false T1mes 230 — 6y
0
Weird system, why don't you use tables? User#20388 0 — 6y
0
I was never fond of using tables bluestreakejjp 41 — 6y

1 answer

Log in to vote
0
Answered by
Dog2puppy 168
6 years ago

Simply set the data store to false. Then the player should be unbanned (assuming your just doing a check for if it’s true).

ds:SetAsync(ID_HERE, false)
0
Thanks bluestreakejjp 41 — 6y
0
No problem Dog2puppy 168 — 6y
Ad

Answer this question