Roblox Studio - Hide & Seek Game | Map Voting I

Поділитися
Вставка
  • Опубліковано 1 лют 2025

КОМЕНТАРІ • 16

  • @DrakenTheOg
    @DrakenTheOg 2 місяці тому

    W video fam

  • @tropicalmasterpiece
    @tropicalmasterpiece  2 місяці тому

    Sorry for the wait!
    Anyways, here are the scripts added in this video:

    • @tropicalmasterpiece
      @tropicalmasterpiece  2 місяці тому

      voteHandler LocalScript -
      local repStorage = game:GetService("ReplicatedStorage")
      local events = repStorage:FindFirstChild("Events")
      local voteFolder = repStorage:FindFirstChild("Votes")
      local display = script.Parent
      local voteSender = script.voteSender
      events.sendVote.OnClientEvent:Connect(function()
      display.Visible = true

      -- Clone the votesender into all 3 displays

      for a = 1,3 do
      local clonedVS = voteSender:Clone()
      clonedVS.Parent = display:FindFirstChild("Display"..a)
      clonedVS.Enabled = true
      end
      end)
      events.endVoting.OnClientEvent:Connect(function()
      display.Visible = false
      end)

    • @tropicalmasterpiece
      @tropicalmasterpiece  2 місяці тому

      voteSender LocalScript -
      local repStorage = game:GetService("ReplicatedStorage")
      local events = repStorage:FindFirstChild("Events")
      local sendVote = events:FindFirstChild("sendVote")
      local display = script.Parent
      local voteButton = display:FindFirstChild("VoteButton")
      local voteNumber = display:FindFirstChild("voteNumber").Value
      local mapName = display:FindFirstChild("mapName")
      mapName.Text = repStorage:FindFirstChild("MapVotes"):FindFirstChild(voteNumber).Value
      voteButton.MouseButton1Click:Connect(function()
      sendVote:FireServer(voteNumber)
      end)
      -- Self destruct
      events.endVoting.OnClientEvent:Connect(function()
      script:Destroy()
      end)

    • @tropicalmasterpiece
      @tropicalmasterpiece  2 місяці тому

      voteHandler Script -
      local repStorage = game:GetService("ReplicatedStorage")
      local events = repStorage:FindFirstChild("Events")
      local sendVote = events:FindFirstChild("sendVote")
      local mapVotes = repStorage:FindFirstChild("MapVotes")
      local Votes = repStorage:FindFirstChild("Votes")
      local function finish()
      if #Votes:GetChildren() == repStorage.VotingPlayers.Value then
      -- Count the votes
      local votes = {}

      for playerVote, vote in pairs(Votes:GetChildren()) do
      local voteIndex = vote.Value
      if votes[voteIndex] == nil then
      votes[voteIndex] = 1
      else
      votes[voteIndex] += 1
      end
      end

      -- Determine a winner
      local highestNum = -1
      local winnerMap = nil

      for mapIndex, voteNum in pairs(votes) do
      if voteNum > highestNum then
      highestNum = voteNum
      winnerMap = mapIndex
      end
      end

      -- Convert mapIndex to the chosen map
      local chosenMap = mapVotes:FindFirstChild(winnerMap).Value
      print("Voting over!","Winning map: "..chosenMap)

      -- Send info to the server
      repStorage.VotingFinished.Value = true
      repStorage.WinningMap.Value = chosenMap
      end
      end
      sendVote.OnServerEvent:Connect(function(plr,vote)
      local matchVote = Votes:FindFirstChild(plr.Name)
      if matchVote then
      matchVote:Destroy()
      end

      local plrVote = Instance.new("IntValue",Votes)
      plrVote.Name = plr.Name
      plrVote.Value = vote

      finish()
      end)

    • @tropicalmasterpiece
      @tropicalmasterpiece  2 місяці тому

      Main Script -
      local tweenService = game:GetService("TweenService")
      local players = game:GetService("Players")
      local serverStorage = game:GetService("ServerStorage")
      local serverScriptService = game:GetService("ServerScriptService")
      local repStorage = game:GetService("ReplicatedStorage")
      local pSpawn = repStorage:FindFirstChild("playSpawn")
      local module = require(serverScriptService:FindFirstChild("ExtraCommands"))
      local roundTime = 3 * 60
      local playerFolder = serverStorage:FindFirstChild("Hiders")
      local chosenFolder = serverStorage:FindFirstChild("Seekers")
      local hidercount = repStorage:FindFirstChild("hiderCount")
      local seekercount = repStorage:FindFirstChild("seekerCount")
      local status = repStorage:FindFirstChild("Status")
      local maps = serverStorage:FindFirstChild("Maps")
      while task.wait(5) do
      status.Value = "Waiting for players."
      -- Wait until two players have joined the game
      repeat task.wait() until #players:GetChildren() > 1
      local plrCount = #players:GetChildren()
      -- Begin map voting
      status.Value = "Vote for a map!"
      -- Randomize map selections
      local mapVotes = repStorage:FindFirstChild("MapVotes")
      for a=1,3 do
      mapVotes:FindFirstChild(a).Value = maps:GetChildren()[math.random(1,#maps:GetChildren())].Name
      end
      -- Give our players the voting GUI
      repStorage.Events.sendVote:FireAllClients()
      repStorage.VotingPlayers.Value = plrCount
      -- Countdown
      local cdNum = 0
      while task.wait(1) do
      cdNum += 1
      if cdNum == 30 or repStorage.VotingFinished.Value == true then
      break
      else
      status.Value = "Vote for a map! "..30-cdNum
      end
      end
      local winningMap = repStorage:FindFirstChild("WinningMap").Value
      local wMap = maps:FindFirstChild(winningMap) or maps:GetChildren()[math.random(1,#maps:GetChildren())]
      local cMap = wMap:Clone()
      cMap.Parent = workspace
      -- Reset values
      repStorage.VotingFinished.Value = false
      winningMap = ""
      -- Finish map voting
      status.Value = cMap.Name.." has been chosen"
      repStorage.Events.endVoting:FireAllClients()
      task.wait(2)
      local playSpawn = cMap:FindFirstChild("playSpawn")
      pSpawn.Value = playSpawn.Position
      -- Starting the game
      local random = Random.new()
      local chosen = players:GetChildren()[random.NextInteger(random,1,#game.Players:GetChildren())] -- Picks random player
      print(chosen.Name.." has been chosen as the seeker.")
      for a,b in pairs(players:GetChildren()) do
      if b.Name ~= chosen.Name then -- if player is NOT it
      local playerName = Instance.new("StringValue",playerFolder)
      playerName.Name = b.Name
      local pChar = b.Character or b.CharacterAdded:Wait()
      pChar:PivotTo(playSpawn.CFrame)
      end
      end
      -- Send chosen player into battle
      local seekerTeleport = cMap:FindFirstChild("SeekerTeleport")
      local cChar = chosen.Character or chosen.CharacterAdded:Wait()
      cChar:PivotTo(seekerTeleport.CFrame)
      task.wait(.1)
      cChar.HumanoidRootPart.Anchored = true
      for i = 30,0,-1 do
      task.wait(1)
      status.Value = "Hide: "..i
      end
      cChar.HumanoidRootPart.Anchored = false
      module:setSeeker(chosen)
      -- Restart the game once hiders are no longer playing
      local number = roundTime
      while task.wait(1) do
      number -= 1
      status.Value = number
      hidercount.Value = #playerFolder:GetChildren()
      seekercount.Value = #chosenFolder:GetChildren()
      local over = false
      local Winners = {}
      local winner
      for a,b in pairs(playerFolder:GetChildren()) do
      if players:FindFirstChild(b.Name) == nil then
      b:Destroy()
      end
      end
      for a,b in pairs(chosenFolder:GetChildren()) do
      if players:FindFirstChild(b.Name) == nil then
      b:Destroy()
      end
      end
      if #playerFolder:GetChildren() == 0 then
      over = true
      winner = "Seekers"
      end
      if #chosenFolder:GetChildren() == 0 then
      over = true
      winner = "Hiders"
      end
      if number

    • @xuongphimtranminhuc9900
      @xuongphimtranminhuc9900 2 місяці тому

      thanks that would be much simple for me to do that thanks

  • @TrentsNation5
    @TrentsNation5 Місяць тому

    Hello! just a tip I reccomend you make less complex names for example " NPC path find system " you should do how to make a tower defense path

  • @TristanEliGarcia
    @TristanEliGarcia 2 місяці тому

    Can you comment Round system 2 script in comments & Round system 1??
    Please, and Thank you!

    • @tropicalmasterpiece
      @tropicalmasterpiece  2 місяці тому +1

      Are you referencing the Round System tutorials or the previous Hide & Seek videos?
      As of now, I'm unable to retrieve past Hide & Seek scripts, sorry for the inconvenience.
      I can, however, provide you with scripts from my tutorials.

    • @TristanEliGarcia
      @TristanEliGarcia 2 місяці тому

      @@tropicalmasterpiece yes plz

    • @tropicalmasterpiece
      @tropicalmasterpiece  2 місяці тому

      These should be directly from the round system tutorial videos, hope this helps.
      Main Script -
      local roundTimer = 2 * 60
      local players = game:GetService("Players")
      local repStorage = game:GetService("ReplicatedStorage")
      local maps = repStorage:FindFirstChild("Maps")
      local status = repStorage:FindFirstChild("Status")
      local worldSpawn = workspace:FindFirstChild("worldSpawn")
      while task.wait(10) do
      status.Value = "Waiting for Players"
      repeat task.wait(2) until #players:GetChildren() > 1 -- Waits until there are 2 players in the game
      -- Start the game
      status.Value = "Game Starting"
      task.wait(2)
      local map = maps:GetChildren()[math.random(1,#maps:GetChildren())]:Clone()
      map.Parent = workspace
      local function spawnTeam(folder,team)
      for a,b in pairs(folder) do
      local char = b.Character or b.CharacterAdded:Wait()
      local playingValue = Instance.new("BoolValue",char)
      playingValue.Name = "Playing"
      local spawns = map:FindFirstChild("Spawns"..team)
      local spawnPoint
      if #spawns:GetChildren() > 1 then
      spawnPoint = spawns:GetChildren()[math.random(1,#spawns:GetChildren())]
      char:PivotTo(spawnPoint.CFrame)
      else
      spawnPoint = spawns:GetChildren()[1]
      char:PivotTo(spawnPoint.CFrame)
      end
      end
      end
      -- Randomizing the teams
      local playerFolder = players:GetChildren()
      local playerNumber = #playerFolder
      local team1 = {}
      local team2 = {}
      for i = 1, playerNumber do
      task.wait()
      local n = math.random(1,#playerFolder)
      local player = playerFolder[n]
      table.remove(playerFolder,table.find(playerFolder,player))
      if i

    • @tropicalmasterpiece
      @tropicalmasterpiece  2 місяці тому

      DisplayHandler Script -
      local repStorage = game:GetService("ReplicatedStorage")
      local status = repStorage:FindFirstChild("Status")
      local ui = script.Parent
      local frame = ui.displayFrame
      local statusText = frame.statusText
      status.Changed:Connect(function()
      statusText.Text = status.Value
      end)

  • @death_stares
    @death_stares 2 місяці тому +1

    yo wanna collab?

  • @Dchukwuka040
    @Dchukwuka040 2 місяці тому

    pls can we do a collab