Checking for a models name to be players name

Sorry for the bump.

Why can’t you have a folder called “Plots” in workspace and then when a player joins, you create a folder inside it named after the Player. Then whenever a player creates a plot you can put it in their Plot Folder.

This makes it much easier as you’ll have access to all their plots just by doing :GetChildren() instead of having to loop through EVERY plot in the game and do string manipulation.

1 Like

This would break if the player’s name somehow had one of the Lua pattern characters in it: “( ) . % + - * ? [ ^ $” This case is very unlikely to ever happen. If you really can’t just store plots in a Lua table, I would recommend using the format:

plotId .. "_" .. player.UserId

Then to check use the code:

string.find(plot.Name, "_" .. player.UserId .. "$")

So long as you don’t have too many plots active at once, the loop solution shouldn’t have performance problems.

1 Like