Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How could I create a banland script?

What I mean by this is how could I create a script that uses strings to identify certain players/usernames and teleport them to a game ID of my choice, kind of like the banland script BIG studios put into their "BIG Paintball" Game.

1 comment

0

I will create an answer for you. Have you created a ban land place?

2 answers

✓ Accepted answer

This is quite simple.

All you need to do is create a server script in ServerScriptService then input this code:

Player's Username Script

local placeid = 00000000000 -- The Banland Place ID

local tps = game:GetService("TeleportService") -- Gets TP Service

local banned = { -- Banned Users
	"User1",
	"User2",
	"User3",
	"User4"
}

game.Players.PlayerAdded:Connect(function(player) -- If A Player Joins Runs The Code
	if table.find(banned,player.Name) then -- Checks if Player On List Is Equal To The Player's Username
		tps:Teleport(placeid,player) -- Teleports The User To Banland
	end
end)

Note: THE ABOVE IS USING PLAYER'S USERNAMES. USE THE SCRIPT BELOW FOR PLAYER IDs!

Player's User ID

local placeid = 00000000000 -- The Banland Place ID

local tps = game:GetService("TeleportService") -- Gets TP Service

local banned = { -- Banned User's ID
	00000000000,
	00000000000,
	00000000000,
	00000000000
}

game.Players.PlayerAdded:Connect(function(player) -- If A Player Joins Runs The Code
	if table.find(banned,player.UserId) then -- Checks if Player On List Is Equal To The Player's ID
		tps:Teleport(placeid,player) -- Teleports The User To Banland
	end
end)

If you have any questions. just contact me!

I'd like to see your attempt next time.

local TeleportService = game:GetService("TeleportService")
local Players = game:GetService("Players")

local UserIdList = {
	905646521, --[[ Your Id ]]
	74087102 --// Mine
}

local TeleportPlaceId = --// Place Id

Players.PlayerAdded:Connect(function(Player)
	if (UserIdList[Player.UserId]) then
		TeleportService:Teleport(TeleportPlaceId, Player)
	end
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.