So I am trying to make a plate game, and I don’t really know where to start with spawning the plates. If you don’t know what a plate game is, I’ll try and explain it here. Each player gets a different square area at the start of each round, and a random disaster is chosen on a random plate or a player. I’m trying to replicate that game idea, but I can’t figure out how to make the grid layout for each plate.
As you can see, the plates are evenly spaced out. I wouldn’t want to just put this into the game, because if there aren’t enough players in the server, there will just be a random empty plate that nobody is on.
I don’t recommend making 2 topics for this, but here is what you could do:
Place 9 (or however many plates you want) evenly spaced, 1 studded, non-collide, transparent parts in the places you want plates to spawn. Group these in some folder.
Make a script that generates plates and positions them at these parts. Parent the plates to another folder and number them.
Assign players who will be in the round to a plate, do this by getting a table of all the plate folder’s children (the plates) and choosing a random one, removing that plate from the list as it is assigned a player.
Destroy remaining plates
I would have made a script for this if I wasn’t on mobile. Hope this helps!
local playerService = game:GetService("Players")
playerService.PlayerAdded:Connect(function(player)
local amountOfPlayersInServer = #game:GetService("Players"):GetChildren()
local plates = platesFolder:GetChildren()
for i = 1, #plates do
plates[i].Transparency = 1
plates[i].CanCollide = false
end
for i = 1, #amountOfPlayersInServer do
plates[i].Transparency = 0
plates[i].CanCollide = true
end
end)
local Players = game:GetService(“Players”)
local plateTemplate = game:GetService(“ServerStorage”).Plate
local function startRound()
for i,v in ipairs (workspace.Plates:GetChildren()) do v:Destroy end --assuming you’re making a PoF game, you’d want new plates each round
local validPlates = {}
for i,v in ipairs(workspace.PlatePositions:GetChildren()) do --Make plates
local newPlate = plateTemplate Clone()
newPlate.Parent = workspace.Plates
newPlate.CFrame = v.CFrame
newPlate.Name = “Plate” .. i
table.insert(validPlates, newPlate.Name)
end
for i,v in ipairs(Players:GetPlayers ()) do
if #validPlates < 1 then warn(“not enough plates!”) return end
-- optionally check if a player is going to play
local assignedPlate = workspace.Plates[validPlates[math.random(1,#validPlates)]]
--assignedPlate.Owner.Value = v Use if you want to know who owns the plate
table.remove(validPlates,table.find(validPlates,assignedPlate.Name))
end
for i,v in ipairs(validPlates) do
workspace.Plates[v]:Destroy()
end
end
This can easily error and I wasn’t able to test because I wrote on mobile. Sorry for the lack of organization. To use it, take the plate and name it “Plate” and put it in ServerStorage. Next, add two folders in workspace, one named “PlatePositions”, and the other named “Plates”. Put (1,1,1) sized parts with no collision, anchor, and transparency in the positions you want plates to spawn. Parent these to “PlatePositions”. Hope this helps!