I am trying to make an Anti Exploit that bans people from the game.
But I am getting Errors from the console!
Here is the script:
local DataStore = game:GetService("DataStoreService")
local BanList = DataStore:GetDataStore("BanList")
game.Players.PlayerAdded:Connect(function(Player)
local BoolValue = Instance.new("BoolValue")
BoolValue.Parent = Player
BoolValue.Value = BanList:GetAync(Player.UserId)
BoolValue.Name = "IsBanned"
if BoolValue.Value == true then
Player:Kick("Banned!")
end
end)
The error is: GetAync is not a valid member of GlobalDataStore]
Ok, I attempted to fix your code, tell me if it works or not.
local DataStore = game:GetService("DataStoreService")
local BanList = DataStore:GetDataStore("BanList")
game.Players.PlayerAdded:Connect(function(Player)
banned = BanList:GetAsync(Player.UserId)
if banned == true then
Player:Kick("Banned!")
end
end)
That’s not the problem. The problem is you have used GetAync, not GetAsync. Your script is not working because of that typo.
Your new script should be this (this accounts for the typo, nothing more)
local DataStore = game:GetService(“DataStoreService”)
local BanList = DataStore:GetDataStore(“BanList”)
game.Players.PlayerAdded:Connect(function(Player)
local BoolValue = Instance.new("BoolValue")
BoolValue.Parent = Player
BoolValue.Value = BanList:GetAsync(Player.UserId)
BoolValue.Name = "IsBanned"
if BoolValue.Value == true then
Player:Kick("Banned!")
end
end)
Make a different post or search the Dev Forum for anything relating to the BoolValue, here we should focus on the main thing causing the error, and that would be the typo.