#How do I make a server spawn limit?

1 messages · Page 1 of 1 (latest)

tight grove
#

I'm incredibly new to game dev and want to make people spawn in on the plots I made, however I can only put a certain amount of plots in one server. How can I make the game check for the available plots before they join, and if there aren't any, send them to another server? It's just confusing to wrap my head around the idea of the code working before they even load in. Thanks for reading my plea lol.

wise snow
#

you can literally just cahnge the server size to be the amount of plots you want

tight grove
wise snow
#

huh?

#

like an arrow to available plots?

#

1st way that comes to mind is assinging each plot with a booleanvalue and making an arrow script that points to all plots that have the boolvalue set to false

#

(when claiming the boolvalue is set to true)

tight grove
# wise snow like an arrow to available plots?

Kind of? I want the player to just spawn in with an already assigned plot after loading. Like from the point of spawn my plot is just mine and I don't have to claim it. I know im going to need the server to check for available plots but idk how to immeadiately assign them one of the avaialble one's once they open the game.

wise snow
#

well you can use a for loop in pairs with a folder you use to hold the plots

#

like folder:GetChildren()

#

and the first plot to have the value be false be assigned to that player

#

maybe add a proximity prompt or however you want the player to claim it to be enabled on client side

#

all this done in a playeradded event btw

tight grove
#

Im going to add in at the print part the rest of the code, but that I think would work as a base for what im tryna do? Also would I just have to repeat a code like this for my other 6 spawn points?

wise snow
#

not what i had in mind

#

my question is the variable is going to always be set into that single spawnlocation

#

if someone has already claimed it then the entire script fails

#

yeah you CAN add if else and add a variable for each and every plot

#

but lets be real thats alot of work

#

so instead just use for _, i in pairs(workspace:GetChildren())

#

and add if i:IsA("SpawnLocation") to filter it to the spawnlocs only

tight grove
#

Ok, I remade it with the loop. I think it works well. It prints correctly and when I try to take other spawns it wont let me, or at least it wont print it. Do you think I could start adding in stuff that uses a "claim" variable when players spawn in on the plot?

tight grove
hybrid stormBOT
#

studio** You are now Level 1! **studio

wise snow
#

like the instance

#

honestly i can see how you would do that

#

tbh i dont use arrays much

#

but im sure u can use arrays for that instead

#

just try your method, if you encounter an error i'll do my best to help you

tight grove
wise snow
#

if i didnt know how to do something i'd search it up online

#

or ask for help here

#

and then boom i learn something new

#

boolvalues is pretty simple

#

its just an instance that holds a boolean value

#

i use it to assign a value to something that every script can use

#

for that asset

#

theres ofc also numvalues, stringvalues, even instancevalues

tight grove
#

And this is the tool script:

#

wrong order... 😭

wise snow
#

oh boy you might want to consider compacting your script abit