Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Game Link: https://www.roblox.com/games/1075564225/Script-Showcase
- local function RANDOM_MAP_SELECT()
- print("---RANDOM MAP SELECTION---")
- local MapBool = {"Map1","Map2","Map3","Map4","Map5","Map6","Map7"}
- print(table.concat(MapBool,' '))
- for i,v in pairs (MapBool) do
- if i > 4 then return end
- local random = Random.new(tick())
- local randomMap = random:NextInteger(1, #MapBool)
- local map = game:GetService('ReplicatedStorage').Active:WaitForChild(MapBool[randomMap])
- map.Value = true
- map[map.Name]:Clone().Parent = game:GetService('ReplicatedStorage').VoteReady
- table.remove(MapBool, randomMap)
- print(table.concat(MapBool,' '))
- end
- end
- local function APPLYING_MAP()
- print("---APPLYING MAP SELECTION---")
- local MAPS = game:GetService('ReplicatedStorage').VoteReady
- local MapsGrab = game.ReplicatedStorage.VoteReady:GetChildren()
- if MAPS:FindFirstChild(MapsGrab[1].Name).Value == 0 and MAPS:FindFirstChild(MapsGrab[2].Name).Value == 0 and MAPS:FindFirstChild(MapsGrab[3].Name).Value == 0 and MAPS:FindFirstChild(MapsGrab[4].Name).Value == 0 then
- print("---NONE HAS VOTED, RESSETTING SYSTEM---")
- for i,v in pairs(game:GetService('ReplicatedStorage').Active:GetChildren()) do
- if v.Value == true then
- v.Value = false
- game:GetService('ReplicatedStorage').VoteReady[v.Name]:Destroy()
- end
- print(i,v.Value)
- end
- print("---System Resetted---")
- --Locate The Voted Choice
- elseif MAPS:FindFirstChild(MapsGrab[1].Name).Value > MAPS:FindFirstChild(MapsGrab[2].Name).Value and MAPS:FindFirstChild(MapsGrab[3].Name).Value and MAPS:FindFirstChild(MapsGrab[4].Name).Value then
- local Choice1Voted = MapsGrab[1].Name
- print("Map Voted | "..MapsGrab[1].Name)
- --Clear Previous Map Sources
- local MapRemoval = {'Map1','Map2','Map3','Map4','Map5','Map6','Map7'}
- for i,v in pairs (MapRemoval) do
- if workspace:FindFirstChild(v) then
- workspace[v]:Destroy()
- end
- end
- local OrbRemoval = {'OrbSpawns1','OrbSpawns2','OrbSpawns3','OrbSpawns4','OrbSpawns5','OrbSpawns6','OrbSpawns7'}
- for i,v in pairs(OrbRemoval)do
- if workspace:FindFirstChild(v)then
- workspace[v]:Destroy()
- end
- end
- local ConfigRemoval = {'Config1','Config2','Config3','Config4','Config5','Config6','Config7'}
- for i,v in pairs (ConfigRemoval) do
- if game:GetService('Lighting'):FindFirstChild(v) then
- game:GetService('Lighting')[v]:Destroy()
- end
- end
- local ReplicateRemoval = {'ReplicatedStorage1','ReplicatedStorage2','ReplicatedStorage3','ReplicatedStorage4','ReplicatedStorage5','ReplicatedStorage6','ReplicatedStorage7'}
- for i,v in pairs (ReplicateRemoval) do
- if game:GetService('ReplicatedStorage'):FindFirstChild(v) then
- game:GetService('ReplicatedStorage')[v]:Destroy()
- end
- end
- if Choice1Voted == "Map1" then
- game:GetService('ServerStorage').Maps.Map1.Map1:Clone().Parent = workspace
- game:GetService('ServerStorage').Maps.Map1.OrbSpawns1:Clone().Parent = workspace
- game:GetService('ServerStorage').Maps.Map1.Config1:Clone().Parent = game:GetService('Lighting')
- game:GetService('ServerStorage').Maps.Map1.ReplicatedStorage1:Clone().Parent = game:GetService('ReplicatedStorage')
- local LightingMover = game:GetService('ServerStorage').Maps.Map1.Lighting1:GetDescendants()
- for i,v in pairs (LightingMover) do
- if v:IsA("Sky") or v:IsA("ColorCorrectionEffect") or v:IsA("BlurEffect") or v:IsA("BloomEffect") or v:IsA("SunRaysEffect") then
- v:Clone().Parent = game:GetService('Lighting')
- end
- end
- plr:LoadCharacter()
- elseif Choice1Voted == "Map2" then
- game:GetService('ServerStorage').Maps.Map2.Map2:Clone().Parent = workspace
- game:GetService('ServerStorage').Maps.Map2.OrbSpawns2:Clone().Parent = workspace
- game:GetService('ServerStorage').Maps.Map2.Config2:Clone().Parent = game:GetService('Lighting')
- game:GetService('ServerStorage').Maps.Map2.ReplicatedStorage2:Clone().Parent = game:GetService('ReplicatedStorage')
- local LightingMover = game:GetService('ServerStorage').Maps.Map2.Lighting2:GetDescendants()
- for i,v in pairs (LightingMover) do
- if v:IsA("Sky") or v:IsA("ColorCorrectionEffect") or v:IsA("BlurEffect") or v:IsA("BloomEffect") or v:IsA("SunRaysEffect") then
- v:Clone().Parent = game:GetService('Lighting')
- end
- end
- plr:LoadCharacter()
- elseif Choice2Voted == "Map3" then
- game:GetService('ServerStorage').Maps.Map3.Map3:Clone().Parent = workspace
- game:GetService('ServerStorage').Maps.Map3.OrbSpawns3:Clone().Parent = workspace
- game:GetService('ServerStorage').Maps.Map3.Config3:Clone().Parent = game:GetService('Lighting')
- game:GetService('ServerStorage').Maps.Map3.ReplicatedStorage3:Clone().Parent = game:GetService('ReplicatedStorage')
- local LightingMover = game:GetService('ServerStorage').Maps.Map3.Lighting3:GetDescendants()
- for i,v in pairs (LightingMover) do
- if v:IsA("Sky") or v:IsA("ColorCorrectionEffect") or v:IsA("BlurEffect") or v:IsA("BloomEffect") or v:IsA("SunRaysEffect") then
- v:Clone().Parent = game.Lighting
- end
- end
- plr:LoadCharacter()
- elseif Choice2Voted == "Map4" then
- game:GetService('ServerStorage').Maps.Map4.Map4:Clone().Parent = workspace
- game:GetService('ServerStorage').Maps.Map4.OrbSpawns4:Clone().Parent = workspace
- game:GetService('ServerStorage').Maps.Map4.Config4:Clone().Parent = game:GetService('Lighting')
- game:GetService('ServerStorage').Maps.Map4.ReplicatedStorage4:Clone().Parent = game:GetService('ReplicatedStorage')
- local LightingMover = game:GetService('ServerStorage').Maps.Map4.Lighting4:GetDescendants()
- for i,v in pairs (LightingMover) do
- if v:IsA("Sky") or v:IsA("ColorCorrectionEffect") or v:IsA("BlurEffect") or v:IsA("BloomEffect") or v:IsA("SunRaysEffect") then
- v:Clone().Parent = game:GetService('Lighting')
- end
- end
- plr:LoadCharacter()
- elseif Choice2Voted == "Map5" then
- game:GetService('ServerStorage').Maps.Map5.Map5:Clone().Parent = workspace
- game:GetService('ServerStorage').Maps.Map5.OrbSpawns5:Clone().Parent = workspace
- game:GetService('ServerStorage').Maps.Map5.Config5:Clone().Parent = game:GetService('Lighting')
- game:GetService('ServerStorage').Maps.Map5.ReplicatedStorage5:Clone().Parent = game:GetService('ReplicatedStorage')
- local LightingMover = game:GetService('ServerStorage').Maps.Map5.Lighting5:GetDescendants()
- for i,v in pairs (LightingMover) do
- if v:IsA("Sky") or v:IsA("ColorCorrectionEffect") or v:IsA("BlurEffect") or v:IsA("BloomEffect") or v:IsA("SunRaysEffect") then
- v:Clone().Parent = game:GetService('Lighting')
- end
- end
- plr:LoadCharacter()
- elseif Choice2Voted == "Map6" then
- game:GetService('ServerStorage').Maps.Map6.Map6:Clone().Parent = workspace
- game:GetService('ServerStorage').Maps.Map6.OrbSpawns6:Clone().Parent = workspace
- game:GetService('ServerStorage').Maps.Map6.Config6:Clone().Parent = game:GetService('Lighting')
- game:GetService('ServerStorage').Maps.Map6.ReplicatedStorage6:Clone().Parent = game:GetService('ReplicatedStorage')
- local LightingMover = game:GetService('ServerStorage').Maps.Map6.Lighting6:GetDescendants()
- for i,v in pairs (LightingMover) do
- if v:IsA("Sky") or v:IsA("ColorCorrectionEffect") or v:IsA("BlurEffect") or v:IsA("BloomEffect") or v:IsA("SunRaysEffect") then
- v:Clone().Parent = game:GetService('Lighting')
- end
- end
- plr:LoadCharacter()
- elseif Choice2Voted == "Map7" then
- game:GetService('ServerStorage').Maps.Map7.Map7:Clone().Parent = workspace
- game:GetService('ServerStorage').Maps.Map7.OrbSpawns7:Clone().Parent = workspace
- game:GetService('ServerStorage').Maps.Map7.Config7:Clone().Parent = game:GetService('Lighting')
- game:GetService('ServerStorage').Maps.Map7.ReplicatedStorage7:Clone().Parent = game:GetService('ReplicatedStorage')
- local LightingMover = game:GetService('ServerStorage').Maps.Map7.Lighting7:GetDescendants()
- for i,v in pairs (LightingMover) do
- if v:IsA("Sky") or v:IsA("ColorCorrectionEffect") or v:IsA("BlurEffect") or v:IsA("BloomEffect") or v:IsA("SunRaysEffect") then
- v:Clone().Parent = game:GetService('Lighting')
- end
- end
- plr:LoadCharacter()
- end
- end
- --//START OF MAP CHANGING\\--
- local PlayerSpeed = game:GetService('ReplicatedStorage').MiscRemotes.PlayerSpeed
- local PlayerJump = game:GetService('ReplicatedStorage').MiscRemotes.PlayerJump
- local VoteSystemShow = game:GetService('ReplicatedStorage').MiscRemotes.VoteShow
- local CanMoveEvent = game:GetService('ReplicatedStorage').MiscRemotes.CanMove
- local ResettingVote = game:GetService('ReplicatedStorage').MiscRemotes.ResetVote
- --Detect a map initiate--
- game:GetService('ReplicatedStorage').InitiateCount.Changed:Connect(function()
- if game:GetService('ReplicatedStorage').Timer.Value == "00:15"then
- local np = game.Players:GetChildren()
- local MaxPlaying = #np
- if game:GetService('ReplicatedStorage').InitiateCount.Value == MaxPlaying then
- game:GetService('ReplicatedStorage').Active.Value = true
- print('Active Map Vote Enabled with'..#np.."Players")
- PlayerJump:FireAllClients(0)
- PlayerSpeed:FireAllClients(0)
- game:GetService('ServerStorage').MapBlur:Clone().Parent = game:GetService('Lighting')
- repeat
- game:GetService('Lighting'):WaitForChild("MapBlur").Size = game:GetService('Lighting').MapBlur.Size +1
- until game:GetService('Lighting').MapBlur.Size >=24
- print("-----------------MAP SYSTEM ENABLED---------------")
- RANDOM_MAP_SELECT()
- VoteSystemShow:FireAllClients(true)
- end
- end
- end)
- game:GetService('ReplicatedStorage').Timer.Changed:Connect(function()
- if game:GetService('ReplicatedStorage').Timer.Value == "00:00" then
- print("-----------------MAP SYSTEM Disabled---------------")
- CanMoveEvent:FireAllClients(true)
- ResettingVote:FireAllClients(false)
- game:GetService('ReplicatedStorage').Active.Value = false
- game:GetService('Lighting'):ClearAllChildren()
- APPLYING_MAP() --This function to apply new map,lighting, and update gui settings is too long(parts of it in pastebin)
- wait(1)
- local CurrentMaps = game:GetService('ReplicatedStorage').VoteReady:GetChildren()
- if #CurrentMaps >=1 then
- for i,v in pairs(game:GetService('ReplicatedStorage').Active:GetChildren()) do
- if v.Value == true then
- v.Value = false
- game:GetService('ReplicatedStorage').VoteReady[v.Name]:Destroy()
- end
- print(i,v.Value)
- end
- end
- --Fire Original Values
- wait(2)
- PlayerJump:FireAllClients(50)
- PlayerSpeed:FireAllClients(16)
- VoteSystemShow:FireAllClients(false)
- game:GetService('ReplicatedStorage').InitiateCount.Value = 0
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement