hey there! i’ve been working on a system like horrific housing’s. i have a plot preset in replicated storage under a folder named Plots. ive been trying all day to make them spawn in a grid like way but i cant make it work… the script clones the plot in replicated storage and assigns a player in it, they then teleport to the plot they were assigned. i just want it to separate and make them spawn in a grid. if you have any questions to further understand let me know! here is my script including just the teleporting not the sorry attempt of putting them in a grid.
any help would be appreciated
local replicatedStorage = game:GetService("ReplicatedStorage")
local workspace = game:GetService("Workspace")
local plotModel = replicatedStorage:WaitForChild("Plots").plot
local playerPlots = {}
local function duplicatePlotsForPlayers(player)
local plotClone = plotModel:Clone()
plotClone.Parent = workspace
playerPlots[player] = plotClone
end
local function teleportPlayerToPlot(player)
local assignedPlot = playerPlots[player]
if assignedPlot then
local spawnLocation = assignedPlot:FindFirstChild("SpawnLocation")
if spawnLocation then
local character = player.Character
if character then
wait(1)
local humanoidRootPart = character:WaitForChild("HumanoidRootPart")
humanoidRootPart.CFrame = CFrame.new(spawnLocation.Position)
end
end
end
end
local function onPlayerJoined(player)
player.CharacterAdded:Connect(function(character)
duplicatePlotsForPlayers(player)
teleportPlayerToPlot(player)
end)
end
for _, player in pairs(game.Players:GetPlayers()) do
onPlayerJoined(player)
end
game.Players.PlayerAdded:Connect(onPlayerJoined)