I am currently making a script for an admin panel that will be toggleable and make it so that if it is on it will kick any player who dies and if they try to rejoin it will kick them again forever in that specific server.
I am having some issues with this, can anyone help me?
local button = script.Parent
local debounce = false
button.MouseButton1Click:Connect(function()
if debounce == false then
debounce = true
game.Players.PlayerAdded:Connect(function(plr)
if plr:GetAttribute("Died") then
plr:Kick("you already died bozo.")
end
end)
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character.Humanoid.Died:Connect(function()
player:Kick("You died!")
player:SetAttribute("Died")
end)
end)
end)
button.BackgroundColor3 = Color3.fromRGB(62, 84, 57)
elseif debounce == true then
debounce = false
button.BackgroundColor3 = Color3.fromRGB(84, 61, 61)
end
Make a table in the serverscript and whenever the player is dies put their userId inside the table. Whenever a player joins the game check if the userid is inside the table. If so kick them again. Will only kick players from that server.
I’m pretty new to scripting and don’t know how to do most of what you said, do you think you could try explaining it in some sort of step-by-step guide? If not thats completely fine but I would really appreciate it.
If your trying to make it so that its a permanent death in-server,
Make a folder of dead players, and when someone dies, create a boolvalue named the player in the folder
When player rejoins, findfirstchild of players name in said folder
If there is the instance in the folder, then kick