floppafloppa

PlotHolder System

Nov 14th, 2025 (edited)
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.91 KB | Source Code | 0 0
  1. local replicatedstorage = game.ReplicatedStorage
  2.  
  3. local plotholder = Instance.new("Folder")
  4. plotholder.Parent = replicatedstorage
  5. plotholder.Name = "PlotHolders"
  6.  
  7. local Players = game.Players
  8.  
  9. Players.PlayerAdded:Connect(function(player)
  10.     local plotnumber = Instance.new("IntValue")
  11.     plotnumber.Name = "plotnumber"
  12.     plotnumber.Parent = player
  13.  
  14.     for i = 1, 6 do
  15.         if plotholder:FindFirstChild(i) then
  16.             continue
  17.         end
  18.         local claimplot = Instance.new("ObjectValue")
  19.         claimplot.Parent = plotholder
  20.         claimplot.Name = i
  21.         claimplot.Value = player
  22.        
  23.         plotnumber.Value = i
  24.         break
  25.     end
  26.     if plotnumber.Value == 0 then
  27.         player:Kick("Too many players are in the game!")
  28.     end
  29.     local plotFolder = workspace.Map.Plots:FindFirstChild(plotnumber.Value)
  30.     player.CharacterAdded:Connect(function(character)
  31.         local tppart = plotFolder.TpPart
  32.        
  33.         character:PivotTo(tppart.CFrame)
  34.     end)
  35.     local sign = plotFolder.Sign
  36.     local plottext = sign.DisplayPart.SurfaceGui.TextLabel
  37.     plottext.Text = player.Name .. "'s Plot"
  38.    
  39.     local thumbnailtype = Enum.ThumbnailType.HeadShot
  40.     local thumbnailSize = Enum.ThumbnailSize.Size420x420
  41.    
  42.     local playerIcon, isready = Players:GetUserThumbnailAsync(player.UserId, thumbnailtype, thumbnailSize)
  43.    
  44.     sign.DisplayPart.SurfaceGui.ImageLabel.Image = playerIcon
  45.    
  46.     sign.DisplayPart.SurfaceGui.Enabled = true
  47. end)
  48.  
  49. Players.PlayerRemoving:Connect(function(player)
  50.     local plotNumber = player:FindFirstChild("plotnumber")
  51.     if not plotNumber then return end
  52.  
  53.     local plotIndex = tostring(plotNumber.Value)
  54.     local plotClaimed = plotholder:FindFirstChild(plotIndex)
  55.     if plotClaimed then
  56.         plotClaimed:Destroy()
  57.     end
  58.  
  59.     local playerPlot = workspace.Map.Plots:FindFirstChild(plotIndex)
  60.     if playerPlot and playerPlot:FindFirstChild("Sign") then
  61.         local surfaceGui = playerPlot.Sign.DisplayPart:FindFirstChild("SurfaceGui")
  62.         if surfaceGui then
  63.             surfaceGui.Enabled = false
  64.         end
  65.     end
  66. end)
Advertisement
Add Comment
Please, Sign In to add comment