So The System Im trying to Achieve is a Random Map Setter
so like for an example i have Map1, Map2, map3, map 4
it would choose a random map from it. The issue i have is i can’t get it to actually Get all the players and Make it loop through the Maps
for i, maps in pairs(game.ServerStorage.Maps) do
i = math.random(1, 4)
if i then
i:Clone(workspace)
game.Players:GetPlayers(Character.HumanoidRootPart.CFrame == i.Spawn.Position)
end
end
try this:
for i, v in pairs(game.Players:GetChildren()) do
v.Character.HumanoidRootPart.CFrame == i.Spawn.Position
-- R6 VERSION: v.Character.Torso.CFrame == i.Spawn.Position
end
Sorry if it does not work, roblox keeps crashing today
local plrs = {}
for _, v in pairs(game.Players:GetChildren())do
if v then
table.insert(plrs, v)
end
end
local Maps = game.ServerStorage.Maps
local MapsTable = Maps:GetChildren()
local AvailableMaps = MapsTable[math.random(1, #MapsTable)]
local Clone = AvailableMaps:Clone()
Clone.Parent = workspace
for _, v in pairs(plrs)do
local character = v.Character or v.CharacterAdded:Wait()
if character then
local MapSpawn = Clone:WaitForChild("Spawn")
character:WaitForChild("HumanoidRootPart").CFrame = MapSpawn.CFrame + Vector3.new(0, 5, 0)
else
table.remove(plrs, v)
end
end
Also you can try this
my game is in r15
and 30 letter