Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My INTERMISSION system doesnt work. How can i solve it ?

Asked by 4 years ago
game.Players.PlayerAdded:Connect(function()
    game.ServerStorage.Playernum.Value = game.ServerStorage.Playernum.Value + 1
    if game.ServerStorage.Playernum.Value > 1 then
        LocalScript.Disabled = false
        LocalScripte.Disabled = true
    else
        LocalScript.Disabled = true
        LocalScripte.Disabled = false
    end
end)

game.Players.PlayerRemoving:Connect(function()
    game.ServerStorage.Playernum.Value = game.ServerStorage.Playernum.Value - 1
    if game.ServerStorage.Playernum.Value > 1 then
        LocalScript.Disabled = false
        LocalScripte.Disabled = true
    else
        LocalScript.Disabled = true
        LocalScripte.Disabled = false
    end
end)
--script no1 (enough players)
local sutart = 20
for i = sutart,0,-1 do
    wait(1)
    script.Parent.Text = i .. " Secconds Reaming"
end
--script no 2 (not enough players)
while true do
    script.Parent.Text = "Waiting Players."
    wait(1)
    script.Parent.Text = "Waiting Players.."
    wait(1)
    script.Parent.Text = "Waiting Players..."
    wait(1)
end
0
give us details of issue NOOOOOW Gooncreeper 98 — 4y
0
um thx but someone solving already Omerevkizel 27 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago
-- Make a Folder called Value in ReplicatedStorage
-- Make a IntValue Called Intermission In the Value Folder
-- Make a BoolValue Called CurrentMode in the Value Folder
-- Make a IntValue Called RoundTime In the Value Folder

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ValueFolder = ReplicatedStorage:WaitForChild("Value")
local Intermission = ValueFolder.Intermission
local RoundTime = ValueFolder.RoundTime
local CurrentMode = ValueFolder.CurrentMode
local Players = game:GetService("Players")
local PlayingTP = game.Workspace:WaitForChild("Playing") -- Make a Part Called PlayingTP in the Workspace
local LobbyTP = game.Workspace:WaitForChild("LobbyTP") -- Make a Part Called LobbyTP in the Workspace

local function ChangeMode(ModeValue)
   CurrentMode.Value = ModeValue
end

local function IntermissionChanged()
   if Intermission.Value <= 0 then
      ChangeMode(true) -- false = Intermission and true = Playing
   end
end

local function RoundTimeChanged()
   if RoundTimeChanged.Value <= 0 then
      ChangeMode(false) -- false = Intermission and true = Playing
   end
end

local function CurrentModeChanged()
   if CurrentMode.Value == true then
      for _, v in pairs(Players:GetPlayers()) do
         repeat wait() until v.Character -- wait until the character of the player has loaded
         local root = v.Character:WaitForChild("HumanoidRootPart")
         root.CFrame = PlayingTP.CFrame -- Teleport Each Players to the Playing Part
      end
   elseif CurrentMode.Value == false then
         for _, v in pairs(Players:GetPlayers()) do
         repeat wait() until v.Character -- wait until the character of the player has loaded
         local root = v.Character:WaitForChild("HumanoidRootPart")
         root.CFrame = LobbyTP.CFrame -- Teleport Each Players to the Lobby Part
      end
   end
end

RoundTime:GetPropertyChangedSignal("Value"):Connect(RoundTimeChanged) -- When the RoundTime value change.

Intermission:GetPropertyChangedSignal("Value"):Connect(IntermissionChanged) -- When the Intermission value change.

CurrentMode:GetPropertyChangedSignal("Value"):Connect(IntermissionChanged) -- When the CurrentMode value change.

local function Round()
    while wait() do
    if CurrentMode.Value == false then
      if Intermission.Value >= 1 then
         Intermission.Value = Intermission.Value - 1
      elseif CurrentMode.Value == true then
         if RoundTime.Value >= 1 then
         RoundTime.Value = RoundTime.Value - 1
      end
   end
end

local function SetUp()
   local RoundTimeDefault = 100
   local IntermissionDefault = 100
   local IntermissionMode = false
   RoundTime.Value = RoundTimeDefault
   Intermission.Value = IntermissionDefault
   CurrentMode.Value = IntermissionMode
   Round()
end

spawn(SetUp)
Ad

Answer this question