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

Is it possible to make a Ban Function using Data Store?

Asked by 8 years ago
Edited 8 years ago

I am trying to fix this problem but I get so confused please help me. If it is possible please Help.

0
yes Shawnyg 4330 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago

Yes it is possible

Here is an example:

01--Server Script
02local datastore = game:GetService("DataStoreService"):GetDataStore("Bans")
03 
04game.Players.PlayerAdded:connect(function(plr)
05    local key = "user_" .. plr.UserId
06 
07    local banned = Instance.new("BoolValue", plr)
08    banned.Value = datastore:GetAsync(key) or false
09    banned.Name = "Banned"
10 
11    if banned.Value == true then
12        plr:Kick("You have been banned!")
13    end
14 
15 
View all 23 lines...
Ad
Log in to vote
0
Answered by 8 years ago
Edited 8 years ago

how can the code you posted be made to ban players if they try to use commands?

Answer this question