Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How could I create a banland script? [closed]

Asked by
fardxD 9
4 years ago

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.

0
I will create an answer for you. Have you created a ban land place? Aiden_12114 79 — 4y

Closed as Not Constructive by Ziffixture

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

2 answers

Log in to vote
0
Answered by 4 years ago

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!

Ad
Log in to vote
0
Answered by
Ziffixture 6913 Moderation Voter Community Moderator
4 years ago
Edited 4 years ago

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)