-
What do you want to achieve? Keep it simple and clear!
A script where it make’s you permanently banned when on death. -
What is the issue? Include screenshots / videos if possible!
The output shows no error on the script, through the script doesn’t work. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I tried twisting some script, still doesn’t work.
-- a script (not localscript)
local DataStoreService = game:GetService("DataStoreService")
local banDataStore = DataStoreService:getDataStore("banDataStore")
wait(1) -- a delay
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local Humanoid = char:WaitForChild("Humanoid")
if Humanoid.Died or Humanoid.Health == 0 then -- detects if the player is dead
player:Kick("Died. You are permanently banned to this game.") -- bans them
print("banned player")
else
print("unsuccessful")
local pTGBe = player -- possible problem
local banned
local success, errormessage = pcall(function()
banned = banDataStore:GetAsync(PTGBe.UserId)
end)
if banned == true then
player:Kick("Your dead. Your permanently banned.") -- bans them again if they rejoined
print("kicked player & successfully kicked someone")
else
print("unsuccessful")
end
end
end)
end)