**Survival Game Script**
==========================
### Game Description
A survival game with a monster called "Deer" where players are divided into lobbies of 5. The game features a 5000x5000 map with a 100x100 basement containing 4 kids in different rooms. Players can collect items from chests, which have a chance to contain various items.
### Script
```lua
-- Configuration
local MAX_PLAYERS_PER_LOBBY = 5
local LOBBY_COUNT = 4
local MAP_SIZE = 5000
local BASEMENT_SIZE = 100
-- Item Configuration
local items = {
["Old Backpack"] = { chance = 68, price = 0 },
["Medikit"] = { chance = 50, price = 0 },
["Strong Axe"] = { chance = 30, price = 0 },
["Good Axe"] = { chance = 45, price = 0 },
["Bandage"] = { chance = 78, price = 0 },
["Good Sac"] = { chance = 50, price = 0 },
["Revolver"] = { chance = 28, price = 0 },
["Old Flashlight"] = { chance = 70, price = 0 },
}
-- Lobby System
local lobbies = {}
for i = 1, LOBBY_COUNT do
table.insert(lobbies, {})
end
-- Player Added Function
game.Players.PlayerAdded:Connect(function(player)
-- Assign player to lobby
local lobbyIndex = math.floor((#game.Players:GetPlayers() + 1) / MAX_PLAYERS_PER_LOBBY) + 1
if lobbyIndex > #lobbies then
lobbyIndex = 1
end
table.insert(lobbies[lobbyIndex], player)
-- Character setup
player.CharacterAdded:Connect(function(character)
-- Give player old backpack
local oldBackpack = Instance.new("Backpack")
oldBackpack.Name = "Old Backpack"
oldBackpack.Parent = character
-- Move player to spawn location
character.HumanoidRootPart.CFrame = CFrame.new(0, 10, 0)
end)
end)
-- Chest Generation
local function generateChest(x, y, z)
local chest = Instance.new("Part")
chest.Name = "Chest"
chest.CFrame = CFrame.new(x, y, z)
chest.Size = Vector3.new(2, 2, 2)
chest.Parent = game.Workspace
-- Randomly select item
local itemName = ""
local rand = Random.new()
local totalChance = 0
for item, config in pairs(items) do
totalChance += config.chance
end
local roll = rand:NextNumber(0, totalChance)
local currentChance = 0
for item, config in pairs(items) do
currentChance += config.chance
if roll <= currentChance then
itemName = item
break
end
end
-- Add item to chest
local itemInstance = Instance.new("StringValue")
itemInstance.Name = itemName
itemInstance.Parent = chest
end
-- Generate chests
for i = 1, 10 do
generateChest(math.random(-MAP_SIZE / 2, MAP_SIZE / 2), 10, math.random(-MAP_SIZE / 2, MAP_SIZE / 2))
end
-- Basement Generation
local basement = Instance.new("Part")
basement.Name = "Basement"
basement.CFrame = CFrame.new(0, -50, 0)
basement.Size = Vector3.new(BASEMENT_SIZE, 10, BASEMENT_SIZE)
basement.Parent = game.Workspace
-- Kid Generation
for i = 1, 4 do
local kid = Instance.new("Part")
kid.Name = "Kid"
kid.CFrame = CFrame.new(math.random(-BASEMENT_SIZE / 2, BASEMENT_SIZE / 2), -60, math.random(-BASEMENT_SIZE / 2, BASEMENT_SIZE / 2))
kid.Size = Vector3.new(2, 2, 2)
kid.Parent = basement
-- Baby bed
local bed = Instance.new("Part")
bed.Name = "Bed"
bed.CFrame = kid.CFrame - Vector3.new(0, 2, 0)
bed.Size = Vector3.new(2, 1, 2)
bed.Parent = basement
end
-- Item Collection
game.Workspace.DescendantAdded:Connect(function(instance)
if instance.Name == "Chest" then
instance.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
local itemName = instance:GetChildren()[1].Name
local itemInstance = Instance.new("StringValue")
itemInstance.Name = itemName
itemInstance.Parent = player.Backpack
instance:Destroy()
end
end
end)
end
end)
```
**Prompt for User Input**
-------------------------
* Enter the maximum number of players per lobby:
* Enter the number of lobbies:
* Enter the map size:
* Enter the basement size:
* Enter the number of kids:
* Enter the item configurations (chance and price):
Example:
```
Enter the maximum number of players per lobby: 5
Enter the number of lobbies: 4
Enter the map size: 5000
Enter the basement size: 100
Enter the number of kids: 4
Enter the item configurations (chance and price):
Old Backpack: 68, 0
Medikit: 50, 0
Strong Axe: 30, 0
Good Axe: 45, 0
Bandage: 78, 0
Good Sac: 50, 0
Revolver: 28, 0
Old Flashlight: 70, 0
```
To generate scripts you need to add some information . you need to set a proper format