Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local replicatedstorage = game.ReplicatedStorage
- local plotholder = Instance.new("Folder")
- plotholder.Parent = replicatedstorage
- plotholder.Name = "PlotHolders"
- local Players = game.Players
- Players.PlayerAdded:Connect(function(player)
- local plotnumber = Instance.new("IntValue")
- plotnumber.Name = "plotnumber"
- plotnumber.Parent = player
- for i = 1, 6 do
- if plotholder:FindFirstChild(i) then
- continue
- end
- local claimplot = Instance.new("ObjectValue")
- claimplot.Parent = plotholder
- claimplot.Name = i
- claimplot.Value = player
- plotnumber.Value = i
- break
- end
- if plotnumber.Value == 0 then
- player:Kick("Too many players are in the game!")
- end
- local plotFolder = workspace.Map.Plots:FindFirstChild(plotnumber.Value)
- player.CharacterAdded:Connect(function(character)
- local tppart = plotFolder.TpPart
- character:PivotTo(tppart.CFrame)
- end)
- local sign = plotFolder.Sign
- local plottext = sign.DisplayPart.SurfaceGui.TextLabel
- plottext.Text = player.Name .. "'s Plot"
- local thumbnailtype = Enum.ThumbnailType.HeadShot
- local thumbnailSize = Enum.ThumbnailSize.Size420x420
- local playerIcon, isready = Players:GetUserThumbnailAsync(player.UserId, thumbnailtype, thumbnailSize)
- sign.DisplayPart.SurfaceGui.ImageLabel.Image = playerIcon
- sign.DisplayPart.SurfaceGui.Enabled = true
- end)
- Players.PlayerRemoving:Connect(function(player)
- local plotNumber = player:FindFirstChild("plotnumber")
- if not plotNumber then return end
- local plotIndex = tostring(plotNumber.Value)
- local plotClaimed = plotholder:FindFirstChild(plotIndex)
- if plotClaimed then
- plotClaimed:Destroy()
- end
- local playerPlot = workspace.Map.Plots:FindFirstChild(plotIndex)
- if playerPlot and playerPlot:FindFirstChild("Sign") then
- local surfaceGui = playerPlot.Sign.DisplayPart:FindFirstChild("SurfaceGui")
- if surfaceGui then
- surfaceGui.Enabled = false
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment