Folders:
Map==>Map1
Folders consist of
CornerLights
Decorations
Electrical
MapSpawns
Navigation
RoofLights
Tasks
Vents
Walls
EmergencyBtn (model)
Add RemoteEvent: 21 pieces
Camera
CheckTask
Crewmates
Deadbody
Emergency
Endemergency
EquipHat
Fixed
Imposters
Kill
Lights
Main
PlaceVote
PlayAnimation
Reportbody
Sabotage
ShowUi1
ShowUi2
TaskHandler
VentTrigger
Vote
Add IntValue: 3 pieces; Add BoolValue: 1 piece, Add StringValue: 2 pieces
ClassName: IntValue==>EmergencyTime
ClassName: IntValue==>TimeLeft
ClassName: IntValue==>VotingTime
ClassName: BoolValue==>Imposter
ClassName: StringValue==>Status
ClassName: StringValue==>Winner
ChangeColors
DropBody
Events
Main
Sabotage
leaderstats
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local color = Color3.fromRGB(math.random(0, 255), math.random(0, 255), math.random(0, 255))
char:WaitForChild('Body Colors').HeadColor3 = color
char:WaitForChild('Body Colors').LeftArmColor3 = color
char:WaitForChild('Body Colors').LeftLegColor3 = color
char:WaitForChild('Body Colors').RightArmColor3 = color
char:WaitForChild('Body Colors').RightLegColor3 = color
char:WaitForChild('Body Colors').TorsoColor3 = color
end)
end)
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
character.Humanoid.Died:Connect(function()
if player:FindFirstChild('ImposterValue') then
player:FindFirstChild('ImposterValue'):Destroy()
end
if player:FindFirstChild('Crewmate') then
player:FindFirstChild('Crewmate'):Destroy()
end
if player.Name ~= game.ReplicatedStorage.Winner.Value then
if character:FindFirstChild('InGame') then
local body = game.ReplicatedStorage:WaitForChild('Body'):Clone()
body.Parent = workspace
body:SetPrimaryPartCFrame(character:GetPrimaryPartCFrame())
local color = character['LeftFoot'].Color
for i, v in pairs(body:GetChildren()) do
v.Color = color
end
end
end
end)
end)
end)
local cooldown = 15
game.Players.PlayerAdded:Connect(function(player)
local InVent = Instance.new('BoolValue', player)
InVent.Name = 'InVent'
InVent.Value = false
end)
local module = require(game.ServerScriptService:WaitForChild('Main'):WaitForChild('Functions'))
game.ReplicatedStorage.Kill.OnServerEvent:Connect(function(player, crewMate)
for i, v in pairs(workspace:GetChildren()) do
if v.Name == crewMate then
v.Humanoid.Health = 0
end
end
wait()
end)
game.ReplicatedStorage.PlaceVote.OnServerEvent:Connect(function(player, btn)
player.Voted.Value = true
for i, v in pairs(game.Players:GetPlayers()) do
if v then
local playergui = v.PlayerGui
playergui.Voting.Main.Container:FindFirstChild(btn).Votes.Value = playergui.Voting.Main.Container:FindFirstChild(btn).Votes.Value + 1
end
end
end)
game.ReplicatedStorage.EndEmergency.OnServerEvent:Connect(function(player)
module.GetWinner()
for i, v in pairs(game.Players:GetPlayers()) do
if v.Name == game.ReplicatedStorage.Winner.Value then
v.Character.HumanoidRootPart.CFrame = workspace.Teleport.CFrame
end
end
game.ReplicatedStorage.Camera:FireAllClients(player)
workspace.Gravity = 20
wait(3)
workspace.Gravity = 196.2
for i, v in pairs(game.Players:GetPlayers()) do
if v then
v.Character.Humanoid.WalkSpeed = 16
end
end
for i, v in pairs(game.Players:GetPlayers()) do
v.Voted.Value = false
end
for index, v in pairs(workspace:GetChildren()) do
if v.Name == 'Body' then
v:Destroy()
end
end
workspace:FindFirstChild('Map').EmergencyBtn.Cover.ProximityPrompt.Enabled = false
wait(cooldown)
workspace:FindFirstChild('Map').EmergencyBtn.Cover.ProximityPrompt.Enabled = true
end)
game.ReplicatedStorage.Reportbody.OnServerEvent:Connect(function(player)
for i, v in pairs(game.Players:GetPlayers()) do
local charater = v.Character
if charater:FindFirstChild('InGame') then
game.ReplicatedStorage.DeadBody:FireAllClients(player)
charater.HumanoidRootPart.CFrame = workspace.Map.MapSpawns['Spawn'..i].CFrame
charater.Humanoid.WalkSpeed = 0
end
end
for index, v in pairs(workspace:GetChildren()) do
if v.Name == 'Body' then
v:Destroy()
end
end
end)
game.ReplicatedStorage.EquipHat.OnServerEvent:Connect(function(player, hat)
local character = player.Character or player.CharacterAdded:Wait()
for i, v in pairs(character:GetChildren()) do
if v:IsA("Accessory") then
v:Destroy()
end
end
game.ReplicatedStorage.Hats:FindFirstChild(hat):Clone().Parent = character
end)
game.ReplicatedStorage.Lights.OnServerEvent:Connect(function(player)
game.Lighting.FogEnd = 30
end)
game.ReplicatedStorage.Fixed.OnServerEvent:Connect(function(player)
game.Lighting.FogEnd = 100
end)
game.ReplicatedStorage.PlayAnimation.OnServerEvent:Connect(function(player, vent)
local character = player.Character
print(vent)
character.Humanoid.WalkSpeed = 0
for i = 0, 9 do
for i, v in pairs(character:GetDescendants()) do
if v:IsA('MeshPart') or v:IsA("Part") then
v.Transparency = v.Transparency + 0.1
character.Head.face.Transparency = 1
end
end
wait(0.01)
end
player.InVent.Value = true
end)
game.ReplicatedStorage.Main.OnServerEvent:Connect(function(player, vent)
local character = player.Character
if workspace.Map.Vents:FindFirstChild(vent) then
character.HumanoidRootPart.CFrame = workspace.Map.Vents:FindFirstChild(vent).Tp.CFrame
for i = 1, 10 do
for i, v in pairs(character:GetDescendants()) do
if v:IsA('MeshPart') or v:IsA("Part") then
v.Transparency = v.Transparency - 0.1
character.Head.face.Transparency = 0
end
end
wait(0.05)
end
character.Humanoid.WalkSpeed = 16
end
wait(3)
player.InVent.Value = false
end)
game.ReplicatedStorage.CheckTask.OnServerEvent:Connect(function(player, task)
player.Tasks:FindFirstChild(task).Value = true
end)
local module = require(game.ServerScriptService:WaitForChild('Main'):WaitForChild('Functions'))
local status = game.ReplicatedStorage:WaitForChild('Status')
local Time1 = 10
local Time2 = 500
while true do
status.Value = '2 players needed!'
repeat wait(.1) until game.Players.NumPlayers >= 2
wait(5)
-- choose random map
local maps = game.ReplicatedStorage.Maps:GetChildren()
local randomMap = maps[math.random(1, #maps)]
local chosenMap = randomMap:Clone()
chosenMap.Parent = workspace
chosenMap.Name = 'Map'
module.update2()
local players = {}
for i, v in pairs(players) do
if #players ~= 0 then
table.remove(players, i)
end
end
for i, v in pairs(game.Players:GetPlayers()) do
if v then
table.insert(players, v)
end
end
local map = workspace.Map
local tppart = map:FindFirstChild('TPpart')
for i = Time1, 0, -1 do
status.Value = 'Starting in '..i
wait(1)
end
for i, v in pairs(players) do
if v then
local character = v.Character
if character then
local ingame = Instance.new('IntValue', character)
ingame.Name = 'InGame'
character.HumanoidRootPart.CFrame = workspace.Map.MapSpawns['Spawn'..i].CFrame
else
table.remove(players, v)
end
else
table.remove(players, v)
end
end
module.ChooseImposter()
for i = Time2, 0, -1 do
status.Value = i..' Seconds left!'
game.ReplicatedStorage.TimeLeft.Value = i
for index, v in pairs(players) do
if v then
local character = v.Character
if character then
if character:FindFirstChild('InGame') then
else
table.remove(players, index)
end
else
table.remove(players, index)
end
else
table.remove(players, index)
end
end
local thereIsImposter = false
for i, v in pairs(game.Players:GetPlayers()) do
if v:FindFirstChild('ImposterValue') then
thereIsImposter = true
end
end
wait()
local done = false
local playersLeft = #players - 1
print(playersLeft)
-- Add all your tasks here
for i, v in pairs(players) do
if v.Tasks.DownloadData.Value == true and v.Tasks.Scan.Value == true and v.Tasks.PressTheButton.Value == true and v.Tasks.SetNumber.Value == true and v.Tasks.Wifi.Value == true and v.Tasks.FixPc.Value == true and v.Tasks.FixWiring.Value == true and v.Tasks.DivertPower.Value == true and v.Tasks.PrimeShields.Value == true then
v.AllTasksCompleted.Value = true
end
end
for i, v in pairs(players) do
if v.AllTasksCompleted.Value == true then
playersLeft = playersLeft - 1
end
end
if playersLeft == 0 then
for i, v in pairs(game.Players:GetPlayers()) do
if v then
if v:FindFirstChild('ImposterValue') then
v.ImposterValue:Destroy()
end
end
end
break
end
if thereIsImposter == false then
break
end
if #players <= 2 then
break
end
wait(1)
thereIsImposter = false
end
for i,v in pairs(game.Players:GetPlayers()) do
if v then
for x, c in pairs(v.Tasks:GetChildren()) do
c.Value = false
end
end
end
for i, v in pairs(game.Players:GetPlayers()) do
for index, v in pairs(workspace:GetChildren()) do
if v.Name == 'Body' then
v:Destroy()
end
end
local character = v.Character
for i, v in pairs(game.Players:GetPlayers()) do
if v then
character.HumanoidRootPart.CFrame = workspace.Lobby.LobbySpawns["Spawn"..i].CFrame
end
end
if character:FindFirstChild('InGame') then
character:FindFirstChild('InGame'):Destroy()
end
game.ReplicatedStorage.TimeLeft.Value = 0
local imposter = game.ReplicatedStorage.Imposter.Value
for i, v in pairs(game.Players:GetPlayers()) do
if v then
if v:FindFirstChild('ImposterValue') then
module.update()
end
end
end
game.ReplicatedStorage.Imposters:FireAllClients()
game.ReplicatedStorage.Crewmates:FireAllClients()
for i, v in pairs(players) do
if v then
if game.ReplicatedStorage.Imposter.Value == true then
if v:FindFirstChild('ImposterValue') then
if not v:FindFirstChild('Crewmate') then
v.leaderstats.Wins.Value = v.leaderstats.Wins.Value + 1
v.leaderstats.Cash.Value = v.leaderstats.Cash.Value + 10
end
end
else
if not v:FindFirstChild('ImposterValue') then
if v:FindFirstChild('Crewmate') then
v.leaderstats.Wins.Value = v.leaderstats.Wins.Value + 1
v.leaderstats.Cash.Value = v.leaderstats.Cash.Value + 10
end
end
end
end
end
for i, v in pairs(game.Players:GetPlayers()) do
if v:FindFirstChild('ImposterValue') then
v:FindFirstChild('ImposterValue') :Destroy()
end
end
for i, v in pairs(game.Players:GetPlayers()) do
if v:FindFirstChild('Crewmate') then
v:FindFirstChild('Crewmate') :Destroy()
end
end
for i, v in pairs(game.Players:GetPlayers()) do
for x, c in pairs(v:GetChildren()) do
if c:IsA('BoolValue') then
c.Value = false
end
end
end
wait(2)
for i, v in pairs(workspace:GetChildren()) do
if v.Name == 'Map' then
v:Destroy()
end
end
game.Lighting.FogEnd = 100
end
end
local module = {}
function module.ChooseImposter()
local imposter = game.Players:GetPlayers()[math.random(1, #game.Players:GetPlayers())]
local val = Instance.new('BoolValue')
val.Name = "ImposterValue"
val.Parent = imposter
wait()
for i, v in pairs(game.Players:GetPlayers()) do
if v then
if not v:FindFirstChild('ImposterValue') then
local character = v.Character or v.CharacterAdded:Wait()
local crewmate = Instance.new('BoolValue', v)
crewmate.Name = 'Crewmate'
end
end
end
for i, v in pairs(game.Players:GetPlayers()) do
if v:FindFirstChild('ImposterValue') then
game.ReplicatedStorage.ShowUi1:FireClient(v)
else
game.ReplicatedStorage.ShowUi2:FireClient(v)
end
end
end
function module.GetWinner()
local number = 0
local winner = 'Nobody'
local votestable = {
}
for i, v in pairs(game.Players:GetPlayers()) do
if v then
local playergui = v.PlayerGui
local frame = playergui.Voting.Main.Container
for i, v in pairs(frame:GetChildren()) do
if v:IsA('TextButton') then
if v.Name ~= 'Template' then
table.insert(votestable, v)
end
end
end
end
end
for i, v in pairs(votestable) do
local val = v:FindFirstChild('Votes')
if val.Value > number then
number = val.Value
winner = v
end
end
wait(.1)
for i, v in pairs(votestable) do
if v then
table.remove(votestable, i)
end
end
wait(1)
print(winner)
game.ReplicatedStorage.Winner.Value = tostring(winner)
for i, v in pairs(game.Players:GetPlayers()) do
if v then
local playergui = v.PlayerGui
local frame = playergui.Voting.Main.Container
for i, v in pairs(frame:GetChildren()) do
if v:IsA('TextButton') then
if v.Name ~= 'Template' then
table.remove(votestable, i)
end
end
end
end
end
for i, v in pairs(game.Players:GetPlayers()) do
if v then
local playergui = v.PlayerGui
local frame = playergui.Voting.Main.Container
for i, v in pairs(frame:GetChildren()) do
if v:IsA('TextButton') then
if v.Name ~= 'Template' then
v.Votes.Value = 0
end
end
end
end
end
end
function module.update()
game.ReplicatedStorage.Imposter.Value = true
end
function module.update2()
game.ReplicatedStorage.Imposter.Value = false
end
return module
game.ReplicatedStorage.Sabotage.OnServerEvent:Connect(function(player, room)
for i, v in pairs(workspace.Map:GetChildren()) do
if v.Name == room.Name then
for x, c in pairs(v:GetChildren()) do
if c.Name == 'Door' then
c.Transparency = 0
c.CanCollide = true
end
end
end
end
wait(5)
for i, v in pairs(workspace.Map:GetChildren()) do
if v.Name == room.Name then
for x, c in pairs(v:GetChildren()) do
if c.Name == 'Door' then
c.Transparency = 1
c.CanCollide = false
end
end
end
end
end)
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new('Folder', player)
leaderstats.Name = 'leaderstats'
local Cash = Instance.new('IntValue', leaderstats)
Cash.Name = 'Cash'
Cash.Value = 0
local Wins = Instance.new('IntValue', leaderstats)
Wins.Name = 'Wins'
Wins.Value = 0
local AllTasksCopleted = Instance.new('BoolValue', player)
AllTasksCopleted.Name = 'AllTasksCopleted'
AllTasksCopleted.Value = false
local voted = Instance.new('BoolValue', player)
voted.Name = 'Voted'
voted.Value = false
local tasks = Instance.new('Folder', player)
tasks.Name = 'Tasks'
for i, v in pairs(game.ReplicatedStorage.Maps:GetDescendants()) do
if v.Name == 'Tasks' then
for x, c in pairs(v:GetChildren()) do
local val = Instance.new('BoolValue', tasks)
val.Name = c.Name
val.Value = false
end
end
end
end)