how do I add a team spawn for admins only? I looked inside the spawn point and I cant find anything. I look on the web and I cant find anything. please tell me
how to add a spawn for admins only?
1 answer
Do you want to make an admin only spawn? Well, here's how:
-Listing the Admins-
We need a way to list a group of the admin's UserIds. The reason why we're using UserIds instead of Usernames is that the players might change their username, I mean I thought that I would never change my username, but I did, and some scripts messed up.
Well, this is where Arrays come in part. An array is a group of values, which are stored in order depending on how you list them. Arrays are useful for creating a list of things. They are listed in numbers, like 1, 2, 3, etc. For example, if you want to list your types of favorite foods, you can put:
local favfruits = {"Apples", "Pizzas", "Cookies"}
If you want to print a certain "favfruits", then you must do
favfruits[1]
Basically, the [1] prints the "Apples" because it's at the left. So, if you want to print all of them, basically you can make it repeat printing until everything is used. Basically, to know how much favfruits there are, you can say "#favfruits". Here's an example:
local favfruits = {"Apples", "Pizzas", "Cookies"}
local num=0
repeat wait()
num=num+1
print(favfruits[num])
until
num>=#favfruits
This is what you get in the Output:
Apples
Pizzas
Cookies
Ok, enough talking about food, now lets talk about the admins. You do the same thing, only expect that you list the admin's userid instead and rename "favfruits" to "admins"
local admins = {190776054, 51714312}
If you don't know how to get a userid, basically go to the player's profile, and copy the numbers in the link.
Now, we listed the admins. Now we need is the script where it detects if a player is an admin or not.
-Detecting if the player is admin or not-
We need a way to detect when an admin joins the game to give them the RespawnSpawn. That's why we're using the .PlayerAdded event! It's mainly used to detect when a player joins.
game.Players.PlayerAdded:connect(function(plr)
end)
Now, we need to put the code in! We need it to repeat until it finds that the player is an admin or not!
game.Players.PlayerAdded:connect(function(plr)
local admins = {190776054, 51714312}
local num=0
repeat wait()
num=num+1
until
admins[num]==plr.userId or num>=#admins
end)
Now, we just need to make sure it stopped repeating when it detected that the player is an admin or not.
We need to use a if event.
game.Players.PlayerAdded:connect(function(plr)
local admins = {190776054, 51714312}
local num=0
repeat wait()
num=num+1
until
admins[num]==plr.userId or num>=#admins
if plr.userId==admins[num] then
print("It's an admin!")
else
print("Not an admin...")
end
end)
Now, we need it to change it to the "Admins" SpawnPoint. Simply put "plr.RespawnLocation=game.Workspace"
game.Players.PlayerAdded:connect(function(plr)
local admins = {190776054, 51714312}
local num=0
repeat wait()
num=num+1
until
admins[num]==plr.userId or num>=#admins
if plr.userId==admins[num] then
print("It's an admin!")
plr.RespawnLocation=game.Workspace.<whereever the spawn is>
else
plr.RespawnLocation=game.Workspace.<non-admin spawn>
end
end)
And you're all done!
12 comments
This is terrible and overcomplicated
^
The code WORKS at least
@AmWrath I wasted 10 minutes of writing this, and this is what I get :(
where do i put the script?
do i put it inside the spawn?
Raw the code isn’t well written. Also, why didn’t you just suggest to make an admin team and then assign a spawn location to that team?
yeah i made a owner/admin team and i have a spawn for them
Why don't you read the steps... PUT IT IN SERVERSCRIPTSTORAGE, and change "" to the spawn name in workspace and change "" to where the non-admin spawn is
@tkddude2 You can also use ResapwnLocation. THE CODE WORKS.
it doesnt work
it works now.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
there isn't a kind of property like "Admin only" But you can teleport a certain player to a spawn!! good luck scripting it
idk how tho