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.
#How do I make a server spawn limit?
1 messages · Page 1 of 1 (latest)
you can literally just cahnge the server size to be the amount of plots you want
Shiiiit you right. But how do I get the game to find an available plot to claim for the player when they spawn in?
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)
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.
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
I was cooking up something, how does this look?
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?
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
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?
Like as in "if 'plot = claim' then player can do blah blah blah"?
** You are now Level 1! **
do you know about boolvalues?
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
I have no clue ab boolvalues, im not gonna lie. Im super new to devving. Do you know any good places to learn coding or is it all just experience?
i started with basics and just made my own thing
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
Ok I developed an ownership boolvalue and made a tool that detects whether they're in the plot. The output is kinda cluttered due to my attempts to debug the tool, but I just wanted to check if im doing it right. Heres what the spawn script looks like.
And this is the tool script:
wrong order... 😭
oh boy you might want to consider compacting your script abit