How I remove a player permenantly on studio? (A script) I tried many methods.
How to remove a player (script) on studio?
2 answers
You just need to get the player somehow. or you can use the method getplayerfromcharacter and then kick the player.
Pretty simple actually.
local player = game.Players.LocalPlayer
player:Kick()
3 comments
This script would be in a localscript
con, can you tell me, how does he localize the player he wants to delete?
He could just rejoin the game couldn't he?!
I will not make the script, you must do it yourself. Now I will give you hints on how to make one.
Hints
- PlayerAdded
- Kick()
- DataStores/DataPersistance
PlayerAdded
The event is a member of the Players service. It fires once a person joins the game.
game:GetService("Players").PlayerAdded:connect(function(player)
print(player.Name.." has joined the game!")
end)
Fun Facts about PlayerAdded
- It's has a counterpart, PlayerRemoving. It's not PlayerLeaving!
- PlayerAdded cannot be fired in a local script!
Kick
The kick functions kicks the player. It has a secret parameter where you can add text. The text shows up when the player gets kicked.
game:GetService("Players").Player1:Kick("You have been kicked from my game!")
Fun Fact about Kick
- People used to do
:Destroy()instead of Kick!
Data
DataStores is a way to save data. Same with DataPersistence. DataStores works within a game's universe. DataPersistence only saves within a place.
--DataStores
local name = "Test"
local datastore = game:GetService("DataStoreService"):GetDataStore(name)
or
game:GetService("Players").Player:SaveBool(true, "Test")
Fun fact about Data
- DataStores saves within universes or Games and DataPersistence only saves withing PLACES.
Final Product
local ban = game:GetService("DataStoreService"):GetDataStore("Ban")
local text = "You are banned."
bannedlist = {"Player1"}
game:GetService("Players").PlayerAdded:connect(function(plyr)
if ban:GetAsync("user_"..plyr.userId) ~= nil then
if ban:GetAsync("user_"..plyr.userId) == true then
plyr:Kick(text)
end
else
for _,n in pairs(bannedlist) do
if n == plyr.Name then
ban:SetAsync("user_"..plyr.userId, true)
plyr:Kick(text)
end
end
end
end)
Watch out! This
This discussion is preserved as it was. New answers, comments, and votes are closed.

4 comments
can you post some of them, please?
Excuse me but I am wondering why would you want to delete the player in the first place?
@ UserOnly16Characters , for a ban script maybe?
Um, if you're trying to test without a player, do Run (green arrow for the ribbon studio)