Ban Script is not working

Hello!

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]
Err
Is there any way to fix this?

You spelled it like GetAync(), but it’s supposed to be spelled like GetAsync().

1 Like

Yes I know now but there is another problem.
It is not using the Instance.new…

I don’t understand what you’re trying to say, could you please elaborate?

You don’t really need to create a BoolValue for the check, just directly check the bool from the datastore.

1 Like

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)

Yes, I am trying to use a BoolValue to make the ban list.

This is not the problem as @TheWorstOne_2 has stated. The Function is GetAsync not GetAync. It is simply a typo.

Yes, I know but the problem is that I want it for a bool value.

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.