This is also completely wrong, because GetAsync:
“This function returns the latest value of the provided key and a [DataStoreKeyInfo] […] instance. If the key does not exist or if the latest version has been marked as deleted, both return values will be nil.”
That means running :GetAsync() without a key will instantly result in nil.
You will need to run :ListKeysAsync() but this is a bit more complicated. Heres an article to that if you want to stick on that method: How To Get All the data saved inside a datastore
But coming back to your problem, try it like that with using the Player Names as key:
CLIENT:
script.Parent.UNBAN.MouseButton1Click:Connect(function()
print("Clicked") --To detect if the Button is working
task.wait(1) --To make sure Client is loaded when the Event fires, sth thats a problem
game.ReplicatedStorage.UnBan:FireServer(script.Parent.NameTextBox.Text)
end)
--SERVER:
game.ReplicatedStorage.UnBan.OnServerEvent:Connect(function(player, PlayerNameTextBox, ReasonTextBox)
local DataStoreService = game:GetService("DataStoreService")
local TempBanPlayerDataStore = DataStoreService:GetDataStore("TemporaryBanPlayerData")
local PermBanPlayerDataStore = DataStoreService:GetDataStore("PermanentBanPlayerData")
TempBanPlayerDataStore:RemoveAsync(PlayerNameTextBox)
end)
Maybe that will do it.