Hello everyone my ban system is partly not working. The BoolValue says that banned equals true but it will not kick me from the game.
My script:
local datastore = game:GetService('DataStoreService'):GetDataStore('Banned players')
game.Players.PlayerAdded:Connect(function(player)
local bannedval = Instance.new('BoolValue', player)
bannedval.Name = 'Banned'
if player.Banned.Value == true then
player:Kick('You have been banned form the game!')
end
local data
local succes, ermes = pcall(function()
data = datastore:GetAsync(player.UserId)
end)
if succes then
bannedval.Value = data
end
end)
game.Players.PlayerRemoving:Connect(function(player)
local succes, ermes = pcall(function()
datastore:SetAsync(player.UserId, player.Banned.Value)
end)
end)
As you can see the value is set to true. So if someone can help me figure out whats wrong that would be great!