Hi,
I’m currently trying to ban the exploiter when he is firing a Remote. The kick works but the only thing that doesnt work is the ban. This is the code:
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local DataStoreService = game:GetService("DataStoreService")
local banDataStore = DataStoreService:GetDataStore("banDataStore")
local PlayerRemotes_Folder = ReplicatedStorage:WaitForChild("PlayerRemotes")
local fakeChangeTime = ReplicatedStorage:FindFirstChild("ChangeTime")
game.Players.PlayerAdded:Connect(function(player)
local banned
local playerUserId = player.UserId
local success, errormessage = pcall(function()
banned = banDataStore:SetAsync(playerUserId)
end)
if banned == true then
player:Kick("SkidBuster | You have been banned for manipulating the game.")
end
fakeChangeTime.OnServerEvent:Connect(function(player)
local success, errormessage = pcall(function()
banDataStore:SetAsync(playerUserId, true)
end)
if success then
print("SkidBuster | Banned user "..player.Name.." With ID: "..playerUserId)
end
player:Kick("SkidBuster | You have been banned for manipulating the game.")
banDataStore:SetAsync(playerUserId, true)
end)
end)
Thanks.