local Workspace = game:GetService("Workspace") local PlotsFolder = Workspace:WaitForChild("Plots") local FORCE_ASSIGN = false local FORCED_PLOT_NAME = "Plot1" local PlotService = {} local PlotOwners = {} function PlotService.GetPlotOwners() return PlotOwners end function PlotService.GetPlot(Player: Player) for Plot, Owner in pairs(PlotOwners) do if Owner == Player then return Plot end end return nil end function PlotService.AssignPlot(Player: Player) if FORCE_ASSIGN then local ForcedPlot = PlotsFolder:FindFirstChild(FORCED_PLOT_NAME) if ForcedPlot then for P, Owner in pairs(PlotOwners) do if Owner == Player or P == ForcedPlot then PlotService.FreePlot(Owner) end end PlotOwners[ForcedPlot] = Player local OwnerTag = ForcedPlot:FindFirstChild("Owner") or Instance.new("ObjectValue") OwnerTag.Name = "Owner" OwnerTag.Value = Player OwnerTag.Parent = ForcedPlot local SignGui = ForcedPlot:FindFirstChild("Sign"):FindFirstChild("GuiPart") and ForcedPlot.Sign.GuiPart:FindFirstChildOfClass("SurfaceGui") local Label = SignGui and SignGui:FindFirstChildOfClass("TextLabel") if Label then Label.Text = `{Player.Name}'s Garden` end if Player.Character then PlotService.TeleportToPlot(Player) end Player.CharacterAdded:Connect(function() PlotService.TeleportToPlot(Player) end) return ForcedPlot end end for _, Plot in ipairs(PlotsFolder:GetChildren()) do if not PlotOwners[Plot] then PlotOwners[Plot] = Player local OwnerTag = Plot:FindFirstChild("Owner") or Instance.new("ObjectValue") OwnerTag.Name = "Owner" OwnerTag.Value = Player OwnerTag.Parent = Plot local SignGui = Plot:FindFirstChild("Sign"):FindFirstChild("GuiPart") and Plot.Sign.GuiPart:FindFirstChildOfClass("SurfaceGui") local Label = SignGui and SignGui:FindFirstChildOfClass("TextLabel") if Label then Label.Text = `{Player.Name}'s Garden` end if Player.Character then PlotService.TeleportToPlot(Player) end Player.CharacterAdded:Connect(function() PlotService.TeleportToPlot(Player) end) return Plot end end return nil end function PlotService.TeleportToPlot(Player: Player) local Plot = PlotService.GetPlot(Player) if Plot then local SpawnLocation = Plot:FindFirstChild("Spawn") if SpawnLocation and Player.Character.PrimaryPart then Player.Character:PivotTo(SpawnLocation.CFrame) end end end function PlotService.FreePlot(Player: Player) for Plot, Owner in pairs(PlotOwners) do if Owner == Player then PlotOwners[Plot] = nil local OwnerTag = Plot:FindFirstChild("Owner") if OwnerTag then OwnerTag:Destroy() end local SignGui = Plot:FindFirstChild("Sign"):FindFirstChild("GuiPart") and Plot.Sign.GuiPart:FindFirstChildOfClass("SurfaceGui") local Label = SignGui and SignGui:FindFirstChildOfClass("TextLabel") if Label then Label.Text = `Empty Garden` end return true end end return false end return PlotService