Hey! I’m trying to make it so that when the intermission remote event is finished, it will run the game remote event. However upon startup, it just completely skips the intermission event and automatically runs the game remote event. How can I fix this?
Here are the three scripts I am using.
- Main Script.
- Module.
- OnClient.
Is there anything I can include to achieve what I want?
sorry if the scripts are poorly written, im new trying to work on my first mini project
local playersInGame = 0
local inRound = false
game.Players.PlayerAdded:Connect(function(player)
playersInGame = playersInGame + 1
print(playersInGame)
player.CharacterAdded:Connect(function(character)
if playersInGame >= 2 and inRound == false then
while playersInGame >= 2 do
if inRound == false then
roundModule.runIntermission("Intermission: ", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", inRound)
elseif inRound == true then
roundModule.runGame("Drawer has ", inRound, "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", "60", "61", "62", "63", "64", "65", "66", "67", "68", "69", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "90", "91", "92", "93", "94", "95", "96", "97", "98", "99", "100", "101", "102", "103", "104", "105", "106", "107", "108", "109", "110", "111", "112", "113", "114", "115", "116", "117", "118", "119", "120")
end
end
inRound = false
print(inRound)
elseif playersInGame < 2 then
roundModule.updateStatus("Need at least 1 more player to start!")
end
end)
end)
game.Players.PlayerRemoving:Connect(function(player)
playersInGame = playersInGame - 1
if playersInGame < 2 then
roundModule.updateStatus("Need at least 1 more player to start!")
end
end)```
-- module --
local roundModule = {}
local remoteEventRoundStatus = game.ReplicatedStorage:WaitForChild("RoundStatusRemoteEvent")
local remoteEventRoundIntermission = game.ReplicatedStorage:WaitForChild("IntermissionRemoteEvent")
local remoteEventGameStatus = game.ReplicatedStorage:WaitForChild("GameStatusRemoteEvent")
function roundModule.updateStatus(statusMessage)
game.ReplicatedStorage.Status.Value = statusMessage
remoteEventRoundStatus:FireAllClients(statusMessage)
end
function roundModule.runIntermission(statusMessage, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen)
game.ReplicatedStorage.Status.Value = statusMessage
remoteEventRoundIntermission:FireAllClients(statusMessage, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen)
end
function roundModule.runGame(statusMessage, InRound, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, twentyone, twentytwo, twentythree, twentyfour, twentyfive, twentysix, twentyseven, twentyeight, twentynine, thirty, thirtyone, thirtytwo, thirtythree, thirtyfour, thirtyfive, thirtysix, thirtyseven, thirtyeight, thirtynine, forty, fortyone, fortytwo, fortythree, fortyfour, fortyfive, fortysix, fortyseven, fortyeight, fortynine, fifty, fiftyone, fiftytwo, fiftythree, fiftyfour, fiftyfive, fiftysix, fiftyseven, fiftyeight, fiftynine, sixty, sixtyone, sixtytwo, sixtythree, sixtyfour, sixtyfive, sixtysix, sixtyseven, sixtyeight, sixtynine, seventy, seventyone, seventytwo, seventythree, seventyfour, seventyfive, seventysix, seventyseven, seventyeight, seventynine, eighty, eightyone, eightytwo, eightythree, eighyfour, eightyfive, eightysix, eightyseven, eightyeight, eightynine, ninety, ninetyone, ninentytwo, ninetythree, ninetyfour, ninetyfive, ninetysix, ninetyseven, ninetyeight, ninetynine, onehundred, onehundredone, onehundredtwo, onehundredthree, onehundredfour, onehundredfive, onehundredsix, onehundredseven, onehundredeight, onehundrednine, onehundredten, onehundredeleven, onehundredtwelve, onehundredthirteen, onehundredfourteen, onehundredfifteen, onehundredsixteen, onehundredseventeen, onehundredeighteen, onehundrednineteen, onehundredtwenty)
game.ReplicatedStorage.Status.Value = statusMessage
remoteEventGameStatus:FireAllClients(statusMessage, InRound, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, sixteen, seventeen, eighteen, nineteen, twenty, twentyone, twentytwo, twentythree, twentyfour, twentyfive, twentysix, twentyseven, twentyeight, twentynine, thirty, thirtyone, thirtytwo, thirtythree, thirtyfour, thirtyfive, thirtysix, thirtyseven, thirtyeight, thirtynine, forty, fortyone, fortytwo, fortythree, fortyfour, fortyfive, fortysix, fortyseven, fortyeight, fortynine, fifty, fiftyone, fiftytwo, fiftythree, fiftyfour, fiftyfive, fiftysix, fiftyseven, fiftyeight, fiftynine, sixty, sixtyone, sixtytwo, sixtythree, sixtyfour, sixtyfive, sixtysix, sixtyseven, sixtyeight, sixtynine, seventy, seventyone, seventytwo, seventythree, seventyfour, seventyfive, seventysix, seventyseven, seventyeight, seventynine, eighty, eightyone, eightytwo, eightythree, eighyfour, eightyfive, eightysix, eightyseven, eightyeight, eightynine, ninety, ninetyone, ninentytwo, ninetythree, ninetyfour, ninetyfive, ninetysix, ninetyseven, ninetyeight, ninetynine, onehundred, onehundredone, onehundredtwo, onehundredthree, onehundredfour, onehundredfive, onehundredsix, onehundredseven, onehundredeight, onehundrednine, onehundredten, onehundredeleven, onehundredtwelve, onehundredthirteen, onehundredfourteen, onehundredfifteen, onehundredsixteen, onehundredseventeen, onehundredeighteen, onehundrednineteen, onehundredtwenty)
end
return roundModule
-- onclient --
local status = game.ReplicatedStorage:WaitForChild("Status")
local remoteEventRoundStatus = game.ReplicatedStorage:WaitForChild("RoundStatusRemoteEvent")
local remoteEventRoundIntermission = game.ReplicatedStorage:WaitForChild("IntermissionRemoteEvent")
local remoteEventRoundGame = game.ReplicatedStorage:WaitForChild("GameStatusRemoteEvent")
local roundLabel = script.Parent
local intermission
remoteEventRoundStatus.OnClientEvent:Connect(function(statusMessage)
roundLabel.Text = statusMessage
end)
intermission = remoteEventRoundIntermission.OnClientEvent:Connect(function(statusMessage, one, two, three, four, five, six, seven, eight, nine, ten, eleven, twelve, thirteen, fourteen, fifteen, inRound)
roundLabel.Text = statusMessage..fifteen
wait(1)
roundLabel.Text = statusMessage..fourteen
wait(1)
roundLabel.Text = statusMessage..thirteen
wait(1)
roundLabel.Text = statusMessage..twelve
wait(1)
roundLabel.Text = statusMessage..eleven
wait(1)
roundLabel.Text = statusMessage..ten
wait(1)
roundLabel.Text = statusMessage..nine
wait(1)
roundLabel.Text = statusMessage..eight
wait(1)
roundLabel.Text = statusMessage..seven
wait(1)
roundLabel.Text = statusMessage..six
wait(1)
roundLabel.Text = statusMessage..five
wait(1)
roundLabel.Text = statusMessage..four
wait(1)
roundLabel.Text = statusMessage..three
wait(1)
roundLabel.Text = statusMessage..two
wait(1)
roundLabel.Text = statusMessage..one
wait(1)
inRound = true
print(inRound)
end)
remoteEventRoundGame.OnClientEvent:Connect(function(statusMessage, InRound, onehundred, onehundredone, onehundredtwo, onehundredthree, onehundredfour, onehundredfive, onehundredsix, onehundredseven, onehundredeight, onehundrednine, onehundredten, onehundredeleven, onehundredtwelve, onehundredthirteen, onehundredfourteen, onehundredfifteen, onehundredsixteen, onehundredseventeen, onehundredeighteen, onehundrednineteen, onehundredtwenty)
roundLabel.Text = statusMessage..onehundredtwenty.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundrednineteen.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundredeighteen.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundredseventeen.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundredsixteen.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundredfifteen.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundredfourteen.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundredthirteen.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundredtwelve.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundredeleven.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundredten.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundrednine.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundredeight.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundredseven.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundredsix.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundredfive.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundredfour.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundredthree.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundredtwo.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundredone.." seconds remaining"
wait(1)
roundLabel.Text = statusMessage..onehundred.." seconds remaining"
wait(1)
InRound = false
print(InRound)
end)