Hello!
I’m a pretty new dev on Roblox who’s coming from having experience in Java, so I’m trying to get the hang of how Roblox and Lua coding works. I’m getting used to the syntax, but I’m admittedly still trying to understand how Roblox handles worlds better, so I figured I’d ask for help on here.
Is there a good way to create localized/singleplayer worlds on a per-player basis, so for example, have a main town hub where everyone spawns in, but from there each player can leave to their own house/farm/etc?
I’d prefer not to have multiple players’ farms in a single area, since my current idea for optimization was to have one area for each player, and spawn in any extra parts the players might need to access out of view of the main map (so, for example, when the player enters their area from the town, they’d come out into the farm. If they enter the house, the house interior model would be spawned in behind the farm area, with the camera locked so they can’t turn around and see the farm area behind them). This would enable me to swap different sub areas in or out as needed, without requiring each player to have multiple areas to their name. However, due to the large variability of size in the pieces I’d be spawning in, that might make it difficult to place multiple players in a single area without having to put them massively far apart (unless there’s an easier way to do that without them seeing each other from the farm area?), and it means I’d have to add in a lot more code to make sure each player is at the proper area in the first place. I also can’t stack players apartment-style-- since the world is supposed to be open to the sky.
Alternatively, I’m wondering if it would be possible to reserve a certain number of empty worlds on a per-server basis, with a maximum number matching the max number of people on the server. Then, when a player joins, one of these worlds is designated for them, and when they leave that designation is removed. This would alleviate the issue of creating a new world for every single player, and would still make it reasonably easy for me to differentiate between whose house is where. I could also still spawn in set pieces in the secret back area behind the farm as needed, regardless of their size.
If possible, I’d also like to make it so that friends can visit the player’s world-- without being able to build there or anything. This wouldn’t require any transfer of ownership-- I’d just have to get them to the player’s farm in the first place. I have a fairly good idea of how to allow/disallow access to sub areas from there, so the question would just be making it so that someone can visit another player’s region.
The issue is that I’m not sure how to go about that. I know Roblox has a “place” system, though admittedly I’m still trying to figure out how that works. From what I imagine the town would qualify as the “starting place”, and each player world might need to be a new place as well? But it seemed like places were pre-set and based off an ID, so I’m not sure if there’s a way to easily connect them to a player. I’m also not sure if they have their own player caps, or if they’re connected to the server-- for example, I’ve seen games that transferred people to an entirely different game, and so when you spawned in, there were totally different people than those on your original server. If places work the same way, and count as their own separate servers, then I’m not sure my second method of having empty worlds would work too well, since people could be teleporting in from different servers. If places are still locked to the players on each server, though, static places might work just fine.
I’ve been poking around on the dev forums and elsewhere on the internet, but the questions I’ve seen about player housing have mostly involved storing data (i.e. if a player places a chair, how do you save its position/rotation etc.). I think I’m pretty clear on that aspect of it all-- it’s just getting them to their unique place in the first place where I’m unsure. I can’t say I’ve tested this out much because I’m frankly unsure of how to proceed.
Does anyone know how a system like this might be possible, and if my methods for going about it sound viable or if I should be trying something different?
Thanks, and have a great day!