Greetings, developers! I created a chat-based ban system, however, it doesn’t work, and there’s nothing I know of that can fix it.
local DataStoreService = game:GetService("DataStoreService")
local DataStore = DataStoreService:GetDataStore("DABans_jskduejuhasudh84jasdh3")
local Players = game:GetService("Players")
local Reason =
local function fullNameFromPartial(plr, message)
for i, v in pairs(game.Players:GetPlayers()) do
if v.Name:lower():sub(1,#message) == message:lower() then
plr = v
end
end
end
game.Players.PlayerAdded:Connect(function(plr)
plr.Chatted:Connect(function(Message)
if string.lower(string.sub(Message[1])) == "/ban" then
local Player =
fullNameFromPartial(Player, Message[2])
if Player then
Reason = Message[3]
DataStore:SetAsync(Player.UserId, true, Reason)
Player:Kick(Reason)
end
end
end)
end)
Players.PlayerAdded:Connect(function(playr)
if DataStore:GetAsync(playr.UserId, true) then
playr:Kick(Reason)
end
end)
Any help is appreciated! (Btw, there’s like a million player variables LOL!)
