YOUR AD GOES HERE

Plot Assignation System

Published 17, Aug 2025

MyRestaurantServer22


Description:
My discord server to hire: https://discord.gg/tfEnBxnGcs

Preparation:
Folder in ReplicatedStorage called Modules.
ModuleScript in Modules called PlotManager
Script in ServerScriptService called AssignPlot
Folder in workspace called Plots
Make sure the children of Plots has a children called "Spawn"

PlotManager code:
local PlotManager = {}

local Players = game:GetService("Players")
local Workspace = game:GetService("Workspace")

local PlotsFolder = Workspace:WaitForChild("Plots")

local PlayerPlots = {}

local function GetPlot()
for _, plot in PlotsFolder:GetChildren() do
if not PlayerPlots[plot] then
return plot
end
end

return nil
end

function PlotManager.AssignPlot(player)
if PlayerPlots[player] then
return PlayerPlots[player]
end

local plot = GetPlot()

if plot then
PlayerPlots[player] = plot
PlayerPlots[plot] = player

local spawn = plot:FindFirstChild("Spawn")
if spawn and player.Character and player.Character:FindFirstChild("HumanoidRootPart") then
player.Character:MoveTo(spawn.Position + Vector3.new(0, 3, 0))
end
end

return plot
end

function PlotManager.GetPlot(player)
return PlayerPlots[player]
end

function PlotManager.RemovePlot(player)
local plot = PlayerPlots[player]

if plot then
PlayerPlots[plot] = nil
PlayerPlots[player] = nil
end
end

Players.PlayerAdded:Connect(function(player)
PlotManager.RemovePlot(player)
end)

return PlotManager

-----------------------------------------------------------------------------------

AssignPlot code:
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")

local PlotManager = require(ReplicatedStorage:WaitForChild("Modules"):WaitForChild("PlotManager"))

Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function()
local plot = PlotManager.AssignPlot(player)
if plot then
print(player.Name .. " has been assigned to " .. plot.Name)
else
warn("No plot available for " .. player.Name)
end
end)
end)

Players.PlayerRemoving:Connect(function(player)
PlotManager.RemovePlot(player)
end)

Releted More Videos

  • Sorry!!! Nothing to show

You May Also Like

YOUR AD GOES HERE

YOUR AD GOES HERE