Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Converted with ttyyuu12345's model to script plugin v4
- function sandbox(var,func)
- local env = getfenv(func)
- local newenv = setmetatable({},{
- __index = function(self,k)
- if k=="script" then
- return var
- else
- return env[k]
- end
- end,
- })
- setfenv(func,newenv)
- return func
- end
- cors = {}
- mas = Instance.new("Model",game:GetService("Lighting"))
- Part0 = Instance.new("Part")
- SurfaceGui1 = Instance.new("SurfaceGui")
- Frame2 = Instance.new("Frame")
- TextLabel3 = Instance.new("TextBox")
- Frame4 = Instance.new("Frame")
- Frame5 = Instance.new("Frame")
- Frame6 = Instance.new("Frame")
- Frame7 = Instance.new("Frame")
- Frame8 = Instance.new("Frame")
- Frame9 = Instance.new("Frame")
- Frame10 = Instance.new("Frame")
- TextLabel11 = Instance.new("TextBox")
- TextLabel12 = Instance.new("TextBox")
- TextLabel13 = Instance.new("TextBox")
- TextLabel14 = Instance.new("TextBox")
- TextLabel15 = Instance.new("TextBox")
- TextLabel16 = Instance.new("TextBox")
- TextLabel17 = Instance.new("TextBox")
- Frame18 = Instance.new("Frame")
- TextLabel19 = Instance.new("TextBox")
- TextLabel20 = Instance.new("TextBox")
- ScrollingFrame21 = Instance.new("ScrollingFrame")
- UIGridLayout22 = Instance.new("UIGridLayout")
- Frame23 = Instance.new("Frame")
- TextLabel24 = Instance.new("TextBox")
- TextLabel25 = Instance.new("TextBox")
- Part0.Name = "board"
- Part0.Parent = mas
- Part0.CFrame = CFrame.new(0, 6.7, -25, 0, 0, 1, 0, 1, 0, -1, 0, 0)
- Part0.Position = Vector3.new(0, 6.7, -25)
- Part0.Color = Color3.new(0, 0, 0)
- Part0.Size = Vector3.new(0.8999998569488525, 13.40000057220459, 21.899999618530273)
- Part0.Anchored = true
- Part0.BottomSurface = Enum.SurfaceType.Smooth
- Part0.BrickColor = BrickColor.new("Really black")
- Part0.Material = Enum.Material.SmoothPlastic
- Part0.TopSurface = Enum.SurfaceType.Smooth
- Part0.brickColor = BrickColor.new("Really black")
- SurfaceGui1.Parent = Part0
- SurfaceGui1.Face = Enum.NormalId.Left
- SurfaceGui1.ClipsDescendants = true
- SurfaceGui1.ZIndexBehavior = Enum.ZIndexBehavior.Sibling
- SurfaceGui1.Adornee = Part0
- Frame2.Name = "main"
- Frame2.Parent = SurfaceGui1
- Frame2.Size = UDim2.new(1, 0, 1, 0)
- Frame2.BackgroundColor = BrickColor.new("Really black")
- Frame2.BackgroundColor3 = Color3.new(0, 0, 0)
- TextLabel3.Name = "title"
- TextLabel3.Parent = Frame2
- TextLabel3.Position = UDim2.new(0.5, 0, 0.5, 0)
- TextLabel3.Size = UDim2.new(1, 0, 0.300000012, 0)
- TextLabel3.AnchorPoint = Vector2.new(0.5, 0.5)
- TextLabel3.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel3.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel3.BackgroundTransparency = 1
- TextLabel3.Font = Enum.Font.SourceSans
- TextLabel3.FontSize = Enum.FontSize.Size14
- TextLabel3.Text = [[Press "E" to enter the minigame!
- Press the key that shows up before the timer runs out!]]
- TextLabel3.TextColor = BrickColor.new("Institutional white")
- TextLabel3.TextColor3 = Color3.new(1, 1, 1)
- TextLabel3.TextScaled = true
- TextLabel3.TextSize = 14
- TextLabel3.TextStrokeTransparency = 0
- TextLabel3.TextWrap = true
- TextLabel3.TextWrapped = true
- Frame4.Name = "game"
- Frame4.Parent = Frame2
- Frame4.Visible = false
- Frame4.Size = UDim2.new(1, 0, 1, 0)
- Frame4.BackgroundColor = BrickColor.new("Really black")
- Frame4.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame4.ZIndex = 2
- Frame5.Name = "bar"
- Frame5.Parent = Frame4
- Frame5.Position = UDim2.new(0.5, 0, 0.100000001, 0)
- Frame5.Size = UDim2.new(0.899999976, 0, 0.0700000003, 0)
- Frame5.AnchorPoint = Vector2.new(0.5, 0.5)
- Frame5.BackgroundColor = BrickColor.new("Medium brown")
- Frame5.BackgroundColor3 = Color3.new(0.227451, 0.227451, 0.227451)
- Frame5.BorderColor = BrickColor.new("Lilac")
- Frame5.BorderColor3 = Color3.new(0.443137, 0.356863, 0.701961)
- Frame5.BorderSizePixel = 3
- Frame6.Name = "left"
- Frame6.Parent = Frame5
- Frame6.Size = UDim2.new(0.999885321, 0, 1, 0)
- Frame6.BackgroundColor = BrickColor.new("Lime green")
- Frame6.BackgroundColor3 = Color3.new(0, 1, 0)
- Frame6.BorderSizePixel = 0
- Frame7.Name = "split"
- Frame7.Parent = Frame5
- Frame7.Position = UDim2.new(0.25, 0, 0, 0)
- Frame7.Size = UDim2.new(0, 5, 1, 0)
- Frame7.BackgroundColor = BrickColor.new("Really black")
- Frame7.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame7.BorderSizePixel = 0
- Frame7.ZIndex = 2
- Frame8.Name = "split"
- Frame8.Parent = Frame5
- Frame8.Position = UDim2.new(0.5, 0, 0, 0)
- Frame8.Size = UDim2.new(0, 5, 1, 0)
- Frame8.BackgroundColor = BrickColor.new("Really black")
- Frame8.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame8.BorderSizePixel = 0
- Frame8.ZIndex = 2
- Frame9.Name = "split"
- Frame9.Parent = Frame5
- Frame9.Position = UDim2.new(0.75, 0, 0, 0)
- Frame9.Size = UDim2.new(0, 5, 1, 0)
- Frame9.BackgroundColor = BrickColor.new("Really black")
- Frame9.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame9.BorderSizePixel = 0
- Frame9.ZIndex = 2
- Frame10.Name = "input"
- Frame10.Parent = Frame4
- Frame10.Position = UDim2.new(0.5, 0, 0.646000028, 0)
- Frame10.Size = UDim2.new(0.528440416, 0, 0.603418827, 0)
- Frame10.AnchorPoint = Vector2.new(0.5, 0.5)
- Frame10.BackgroundColor = BrickColor.new("Really black")
- Frame10.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame10.BorderColor = BrickColor.new("Institutional white")
- Frame10.BorderColor3 = Color3.new(1, 1, 1)
- Frame10.BorderSizePixel = 3
- TextLabel11.Name = "key"
- TextLabel11.Parent = Frame10
- TextLabel11.Position = UDim2.new(0.5, 0, 0.5, 0)
- TextLabel11.Size = UDim2.new(0.5, 0, 0.5, 0)
- TextLabel11.AnchorPoint = Vector2.new(0.5, 0.5)
- TextLabel11.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel11.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel11.BackgroundTransparency = 1
- TextLabel11.Font = Enum.Font.SourceSans
- TextLabel11.FontSize = Enum.FontSize.Size14
- TextLabel11.Text = "A"
- TextLabel11.TextColor = BrickColor.new("Institutional white")
- TextLabel11.TextColor3 = Color3.new(1, 1, 1)
- TextLabel11.TextScaled = true
- TextLabel11.TextSize = 14
- TextLabel11.TextStrokeTransparency = 0
- TextLabel11.TextWrap = true
- TextLabel11.TextWrapped = true
- TextLabel12.Name = "time"
- TextLabel12.Parent = Frame4
- TextLabel12.Position = UDim2.new(0.899999976, 0, 0.970000029, 0)
- TextLabel12.Size = UDim2.new(0.200000003, 0, 0.0495470352, 0)
- TextLabel12.AnchorPoint = Vector2.new(0.5, 0.5)
- TextLabel12.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel12.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel12.BackgroundTransparency = 1
- TextLabel12.Font = Enum.Font.SourceSans
- TextLabel12.FontSize = Enum.FontSize.Size14
- TextLabel12.Text = "time: 0"
- TextLabel12.TextColor = BrickColor.new("Institutional white")
- TextLabel12.TextColor3 = Color3.new(1, 1, 1)
- TextLabel12.TextScaled = true
- TextLabel12.TextSize = 14
- TextLabel12.TextStrokeTransparency = 0
- TextLabel12.TextWrap = true
- TextLabel12.TextWrapped = true
- TextLabel12.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel13.Name = "players"
- TextLabel13.Parent = Frame4
- TextLabel13.Position = UDim2.new(0.899999976, 0, 0.920000017, 0)
- TextLabel13.Size = UDim2.new(0.200000003, 0, 0.0495470352, 0)
- TextLabel13.AnchorPoint = Vector2.new(0.5, 0.5)
- TextLabel13.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel13.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel13.BackgroundTransparency = 1
- TextLabel13.Font = Enum.Font.SourceSans
- TextLabel13.FontSize = Enum.FontSize.Size14
- TextLabel13.Text = "players left: 0"
- TextLabel13.TextColor = BrickColor.new("Institutional white")
- TextLabel13.TextColor3 = Color3.new(1, 1, 1)
- TextLabel13.TextScaled = true
- TextLabel13.TextSize = 14
- TextLabel13.TextStrokeTransparency = 0
- TextLabel13.TextWrap = true
- TextLabel13.TextWrapped = true
- TextLabel13.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel14.Name = "mode"
- TextLabel14.Parent = Frame4
- TextLabel14.Position = UDim2.new(0.899999976, 0, 0.870000005, 0)
- TextLabel14.Size = UDim2.new(0.200000003, 0, 0.0495470352, 0)
- TextLabel14.AnchorPoint = Vector2.new(0.5, 0.5)
- TextLabel14.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel14.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel14.BackgroundTransparency = 1
- TextLabel14.Font = Enum.Font.SourceSans
- TextLabel14.FontSize = Enum.FontSize.Size14
- TextLabel14.Text = "mode: elimination"
- TextLabel14.TextColor = BrickColor.new("Institutional white")
- TextLabel14.TextColor3 = Color3.new(1, 1, 1)
- TextLabel14.TextScaled = true
- TextLabel14.TextSize = 14
- TextLabel14.TextStrokeTransparency = 0
- TextLabel14.TextWrap = true
- TextLabel14.TextWrapped = true
- TextLabel14.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel15.Name = "info"
- TextLabel15.Parent = Frame4
- TextLabel15.Position = UDim2.new(0.499885321, 0, 0.25, 0)
- TextLabel15.Size = UDim2.new(1, 0, 0.100000001, 0)
- TextLabel15.AnchorPoint = Vector2.new(0.5, 0.5)
- TextLabel15.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel15.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel15.BackgroundTransparency = 1
- TextLabel15.Font = Enum.Font.SourceSans
- TextLabel15.FontSize = Enum.FontSize.Size14
- TextLabel15.Text = "Press the key below before the timer above runs out!"
- TextLabel15.TextColor = BrickColor.new("Institutional white")
- TextLabel15.TextColor3 = Color3.new(1, 1, 1)
- TextLabel15.TextScaled = true
- TextLabel15.TextSize = 14
- TextLabel15.TextStrokeTransparency = 0
- TextLabel15.TextWrap = true
- TextLabel15.TextWrapped = true
- TextLabel16.Name = "timer"
- TextLabel16.Parent = Frame2
- TextLabel16.Position = UDim2.new(0.5, 0, 0.850000024, 0)
- TextLabel16.Size = UDim2.new(1, 0, 0.100000001, 0)
- TextLabel16.AnchorPoint = Vector2.new(0.5, 0.5)
- TextLabel16.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel16.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel16.BackgroundTransparency = 1
- TextLabel16.Font = Enum.Font.SourceSans
- TextLabel16.FontSize = Enum.FontSize.Size14
- TextLabel16.Text = "Time left to join: N/A"
- TextLabel16.TextColor = BrickColor.new("Institutional white")
- TextLabel16.TextColor3 = Color3.new(1, 1, 1)
- TextLabel16.TextScaled = true
- TextLabel16.TextSize = 14
- TextLabel16.TextStrokeTransparency = 0
- TextLabel16.TextWrap = true
- TextLabel16.TextWrapped = true
- TextLabel17.Name = "queue"
- TextLabel17.Parent = Frame2
- TextLabel17.Position = UDim2.new(0.5, 0, 0.949999988, 0)
- TextLabel17.Size = UDim2.new(1, 0, 0.100000001, 0)
- TextLabel17.AnchorPoint = Vector2.new(0.5, 0.5)
- TextLabel17.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel17.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel17.BackgroundTransparency = 1
- TextLabel17.Font = Enum.Font.SourceSans
- TextLabel17.FontSize = Enum.FontSize.Size14
- TextLabel17.Text = "In queue: N/A"
- TextLabel17.TextColor = BrickColor.new("Institutional white")
- TextLabel17.TextColor3 = Color3.new(1, 1, 1)
- TextLabel17.TextScaled = true
- TextLabel17.TextSize = 14
- TextLabel17.TextStrokeTransparency = 0
- TextLabel17.TextWrap = true
- TextLabel17.TextWrapped = true
- Frame18.Name = "finish"
- Frame18.Parent = Frame2
- Frame18.Visible = false
- Frame18.Size = UDim2.new(1, 0, 1, 0)
- Frame18.BackgroundColor = BrickColor.new("Really black")
- Frame18.BackgroundColor3 = Color3.new(0, 0, 0)
- Frame18.ZIndex = 3
- TextLabel19.Name = "timer"
- TextLabel19.Parent = Frame18
- TextLabel19.Position = UDim2.new(0.5, 0, 0.949999988, 0)
- TextLabel19.Size = UDim2.new(1, 0, 0.100000001, 0)
- TextLabel19.AnchorPoint = Vector2.new(0.5, 0.5)
- TextLabel19.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel19.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel19.BackgroundTransparency = 1
- TextLabel19.Font = Enum.Font.SourceSans
- TextLabel19.FontSize = Enum.FontSize.Size14
- TextLabel19.Text = "Display closes in: 0"
- TextLabel19.TextColor = BrickColor.new("Institutional white")
- TextLabel19.TextColor3 = Color3.new(1, 1, 1)
- TextLabel19.TextScaled = true
- TextLabel19.TextSize = 14
- TextLabel19.TextStrokeTransparency = 0
- TextLabel19.TextWrap = true
- TextLabel19.TextWrapped = true
- TextLabel20.Name = "title"
- TextLabel20.Parent = Frame18
- TextLabel20.Position = UDim2.new(0.5, 0, 0.0500000007, 0)
- TextLabel20.Size = UDim2.new(1, 0, 0.100000001, 0)
- TextLabel20.AnchorPoint = Vector2.new(0.5, 0.5)
- TextLabel20.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel20.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel20.BackgroundTransparency = 1
- TextLabel20.Font = Enum.Font.SourceSans
- TextLabel20.FontSize = Enum.FontSize.Size14
- TextLabel20.Text = "Leaderboard:"
- TextLabel20.TextColor = BrickColor.new("Institutional white")
- TextLabel20.TextColor3 = Color3.new(1, 1, 1)
- TextLabel20.TextScaled = true
- TextLabel20.TextSize = 14
- TextLabel20.TextStrokeTransparency = 0
- TextLabel20.TextWrap = true
- TextLabel20.TextWrapped = true
- ScrollingFrame21.Name = "list"
- ScrollingFrame21.Parent = Frame18
- ScrollingFrame21.Position = UDim2.new(0.5, 0, 0.100000001, 0)
- ScrollingFrame21.Size = UDim2.new(0.899999976, 0, 0.800000012, 0)
- ScrollingFrame21.Active = true
- ScrollingFrame21.AnchorPoint = Vector2.new(0.5, 0)
- ScrollingFrame21.BackgroundColor = BrickColor.new("Black")
- ScrollingFrame21.BackgroundColor3 = Color3.new(0.192157, 0.192157, 0.192157)
- ScrollingFrame21.ScrollBarThickness = 50
- UIGridLayout22.Parent = ScrollingFrame21
- UIGridLayout22.FillDirection = Enum.FillDirection.Vertical
- UIGridLayout22.SortOrder = Enum.SortOrder.LayoutOrder
- UIGridLayout22.CellPadding = UDim2.new(0, 0, 0, 10)
- UIGridLayout22.CellSize = UDim2.new(1, 0, 0, 100)
- Frame23.Name = "sample_list"
- Frame23.Parent = ScrollingFrame21
- Frame23.Size = UDim2.new(0, 100, 0, 100)
- Frame23.BackgroundColor = BrickColor.new("Institutional white")
- Frame23.BackgroundColor3 = Color3.new(1, 1, 1)
- Frame23.BackgroundTransparency = 1
- TextLabel24.Name = "plr"
- TextLabel24.Parent = Frame23
- TextLabel24.Size = UDim2.new(0.5, 0, 1, 0)
- TextLabel24.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel24.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel24.BackgroundTransparency = 1
- TextLabel24.Font = Enum.Font.SourceSans
- TextLabel24.FontSize = Enum.FontSize.Size14
- TextLabel24.Text = "Roblox"
- TextLabel24.TextColor = BrickColor.new("Institutional white")
- TextLabel24.TextColor3 = Color3.new(1, 1, 1)
- TextLabel24.TextScaled = true
- TextLabel24.TextSize = 14
- TextLabel24.TextStrokeTransparency = 0
- TextLabel24.TextWrap = true
- TextLabel24.TextWrapped = true
- TextLabel24.TextXAlignment = Enum.TextXAlignment.Left
- TextLabel25.Name = "time"
- TextLabel25.Parent = Frame23
- TextLabel25.Position = UDim2.new(0.5, 0, 0, 0)
- TextLabel25.Size = UDim2.new(0.5, 0, 1, 0)
- TextLabel25.BackgroundColor = BrickColor.new("Institutional white")
- TextLabel25.BackgroundColor3 = Color3.new(1, 1, 1)
- TextLabel25.BackgroundTransparency = 1
- TextLabel25.Font = Enum.Font.SourceSans
- TextLabel25.FontSize = Enum.FontSize.Size14
- TextLabel25.Text = "Time: 30"
- TextLabel25.TextColor = BrickColor.new("Institutional white")
- TextLabel25.TextColor3 = Color3.new(1, 1, 1)
- TextLabel25.TextScaled = true
- TextLabel25.TextSize = 14
- TextLabel25.TextStrokeTransparency = 0
- TextLabel25.TextWrap = true
- TextLabel25.TextWrapped = true
- TextLabel25.TextXAlignment = Enum.TextXAlignment.Left
- for i,v in pairs(mas:GetChildren()) do
- v.Parent = script
- pcall(function() v:MakeJoints() end)
- end
- mas:Destroy()
- for i,v in pairs(cors) do
- spawn(function()
- pcall(v)
- end)
- end
- local board = script.board
- local gui = board.SurfaceGui
- local main_ui = gui.main
- local game_ui = main_ui.game
- local finish_ui = main_ui.finish
- local sample_list = finish_ui.list.sample_list
- gui.PixelsPerStud = 100
- gui.SizingMode = Enum.SurfaceGuiSizingMode.PixelsPerStud
- sample_list.Parent = nil
- local join_prompt = Instance.new("ProximityPrompt")
- join_prompt.ClickablePrompt = false
- join_prompt.ActionText = 'Join Queue'
- join_prompt.GamepadKeyCode = Enum.KeyCode.E
- join_prompt.RequiresLineOfSight = false
- join_prompt.UIOffset = Vector2.new(0,-2)
- join_prompt.Exclusivity = Enum.ProximityPromptExclusivity.AlwaysShow
- join_prompt.HoldDuration = 0
- join_prompt.MaxActivationDistance = 15
- join_prompt.Parent = board
- local game_info = {
- max_time = 3,
- low_time = 0.5,
- time_dec = 0.2,
- current_max_time = 0,
- time = 0,
- start_time = 0,
- pressed = {},
- players = {},
- lose_time = {},
- random_keys = 'bcefghjklmnpqrtu', -- wasd is removed because they are move keys, also 16 prompts can only be interacted with in same spot
- key = '',
- playing = 0,
- mode = 'elimination' -- elimination, solo
- }
- game_info.random_keys = string.upper(game_info.random_keys)
- local function sleep(n)
- return task.wait(n or 0)
- end
- local function wrap(f)
- return coroutine.wrap(f)()
- end
- function update_bar()
- local bar = game_ui.bar
- local v = math.clamp((os.clock()-game_info.time)/game_info.current_max_time,0,1)
- bar.left.Size = UDim2.new(v,0,1,0)
- end
- function change_key()
- local i = math.random(string.len(game_info.random_keys))
- local key = string.sub(game_info.random_keys,i,i)
- game_info.key = key
- game_info.pressed = {}
- end
- function update_player_input()
- for plr,val in pairs(game_info.players) do
- local char = plr.Character
- if char then
- local root = char:FindFirstChild("HumanoidRootPart") or char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso")
- if root then
- for i = 1,string.len(game_info.random_keys) do
- local key = string.sub(game_info.random_keys,i,i)
- local prompt = root:FindFirstChild("randomkeys_prompt_" .. key)
- if not prompt then
- prompt = Instance.new("ProximityPrompt")
- prompt.Name = "randomkeys_prompt_" .. key
- prompt.ClickablePrompt = false
- prompt.Style = Enum.ProximityPromptStyle.Custom
- local keycode = Enum.KeyCode:GetEnumItems()
- for i,v in pairs(keycode) do
- if v.Name == key then
- keycode = v
- break
- end
- end
- prompt.GamepadKeyCode = keycode
- prompt.RequiresLineOfSight = false
- prompt.Exclusivity = Enum.ProximityPromptExclusivity.AlwaysShow
- prompt.HoldDuration = 0
- prompt.MaxActivationDistance = 0.01
- prompt.Parent = root
- prompt.Triggered:Connect(function(lplr)
- if lplr == plr then
- if not game_info.pressed[plr] and game_info.players[plr] == 1 then
- if game_info.key == key then
- game_info.pressed[plr] = 1
- else
- game_info.players[plr] = 2
- end
- end
- end
- end)
- end
- end
- end
- end
- end
- end
- function stop()
- game_ui.Visible = false
- for i,v in pairs(finish_ui.list:GetChildren()) do
- if v:IsA("Frame") then
- v:Destroy()
- end
- end
- local lose_time = {}
- for i,v in pairs(game_info.lose_time) do
- local p = 1
- for i,vv in pairs(lose_time) do
- if v > vv[2] then
- p = i
- break
- else
- p = i+1
- end
- end
- table.insert(lose_time,p,{i,v})
- end
- for i,data in pairs(lose_time) do
- local plr,val = unpack(data)
- local c = sample_list:Clone()
- c.plr.Text = plr -- player name instead of player, incase left
- c.time.Text = val-(val%0.1)
- local col = BrickColor.new("Fossil")
- if i == 1 then
- col = BrickColor.new("Gold")
- elseif i == 2 then
- col = BrickColor.new("Silver")
- elseif i == 3 then
- col = BrickColor.new("Bronze")
- end
- c.plr.TextColor = col
- c.time.TextColor = col
- c.Parent = finish_ui.list
- end
- finish_ui.Visible = true
- local max = 5
- for i = 1,max do
- finish_ui.timer.Text = 'Display closes in: ' .. max-i
- sleep(1)
- end
- finish_ui.Visible = false
- for plr,val in pairs(game_info.players) do
- local char = plr.Character
- if char then
- local root = char:FindFirstChild("HumanoidRootPart") or char:FindFirstChild("Torso") or char:FindFirstChild("UpperTorso")
- if root then
- for i = 1,string.len(game_info.random_keys) do
- local key = string.sub(game_info.random_keys,i,i)
- local prompt = root:FindFirstChild("randomkeys_prompt_" .. key)
- if prompt then
- prompt:Destroy()
- end
- end
- end
- end
- end
- game_info.playing = 0
- game_info.players = {}
- join_prompt.Enabled = true
- end
- function update_game()
- update_bar()
- local still_playing = {}
- for plr,val in pairs(game_info.players) do
- if val == 1 then
- table.insert(still_playing,plr)
- end
- end
- local t = os.clock()-game_info.start_time
- t = t-(t%1)
- game_ui.mode.Text = 'mode: ' .. game_info.mode
- game_ui.players.Text = 'players left: ' .. #still_playing
- game_ui.time.Text = 'time: ' .. t
- game_ui.input.key.Text = game_info.key
- game_ui.Visible = true
- end
- function start()
- join_prompt.Enabled = false
- game_info.start_time = os.clock()
- game_info.current_max_time = 1/0
- game_info.key = nil
- local c
- c = game:GetService("RunService").Stepped:Connect(function()
- if game_info.playing == 3 then
- wrap(stop)
- c:Disconnect()
- return
- end
- if not game_info.key or os.clock()-game_info.time >= game_info.current_max_time then
- game_info.time = os.clock()
- game_info.current_max_time = math.clamp(game_info.current_max_time-game_info.time_dec,game_info.low_time,game_info.max_time)
- if game_info.key then
- for plr,val in pairs(game_info.players) do
- if val == 1 and not game_info.pressed[plr] then
- game_info.players[plr] = 2
- end
- end
- end
- change_key()
- end
- update_player_input()
- update_game()
- local still_playing = {}
- for plr,val in pairs(game_info.players) do
- if val == 1 then
- table.insert(still_playing,plr)
- end
- end
- for plr,val in pairs(game_info.players) do
- if val == 1 then
- game_info.lose_time[plr.Name] = os.clock()-game_info.start_time -- keep setting if still playing
- end
- end
- if (#still_playing > 1 and game_info.mode == 'elimination') or (#still_playing >= 1 and game_info.mode == 'solo') then else
- game_info.playing = 3
- end
- end)
- end
- function update_queue(reset)
- local queue = {}
- for plr,val in pairs(game_info.players) do
- if plr and val == 1 then
- table.insert(queue,plr)
- end
- end
- if not reset and #queue >= 1 then
- main_ui.queue.Text = 'In queue: ' .. #queue
- else
- main_ui.queue.Text = 'In queue: N/A'
- end
- end
- function run_queue()
- if game_info.playing == 0 then
- game_info.playing = 1
- local max = 10
- if game:GetService("RunService"):IsStudio() then
- max = 0
- end
- wrap(function()
- for i = 1,max do
- local queue = {}
- for plr,val in pairs(game_info.players) do
- if plr and val == 1 then
- table.insert(queue,plr)
- end
- end
- if #queue >= 1 then
- main_ui.timer.Text = 'Time left to join: ' .. max-i
- sleep(1)
- else
- main_ui.timer.Text = 'Time left to join: N/A'
- update_queue(true)
- game_info.playing = 0
- return
- end
- end
- game_info.playing = 2
- local queue = {}
- for plr,val in pairs(game_info.players) do
- if plr and val == 1 then
- table.insert(queue,plr)
- end
- end
- if 1 >= #queue then
- game_info.mode = 'solo'
- else
- game_info.mode = 'elimination'
- end
- start()
- end)
- end
- end
- join_prompt.Triggered:Connect(function(plr)
- if not game_info.players[plr] and (game_info.playing == 0 or game_info.playing == 1) then
- game_info.players[plr] = 1
- run_queue()
- update_queue()
- end
- end)
Add Comment
Please, Sign In to add comment