local function wait_until_timeout(event, timeout)
if type(timeout) == "number" then
local signal = Instance.new("BindableEvent")
local connection
connection = event:Connect(function(...)
connection:Disconnect()
signal:Fire(...)
end)
delay(timeout, function()
if connection then
connection:Disconnect()
connection = nil
signal:Fire()
end
end)
return signal.Event:Wait()
end
return nil
end
ChoosePlayers:FireClient(Sensei, Settings.ACTIVE_PLAYERS)
ChoosePlayers.OnServerEvent:Connect(function(chosenPlayers)
if #chosenPlayers == 2 then
end
end)
… Except for the fact that the code is gonna be the same
if ChosenPlayers then
if #ChosenPlayers == 2 then
Setup2Players(true, ChosenPlayers)
else
-- Get random 2 players if sensei doesn't pick
for _, player in pairs(Settings.ACTIVE_PLAYERS) do
if #ChosenPlayers < 2 then
if player ~= Sensei then
table.insert(ChosenPlayers, player)
end
end
end
Setup2Players(true, ChosenPlayers)
end
else
-- Get random 2 players if sensei doesn't pick
for _, player in pairs(Settings.ACTIVE_PLAYERS) do
if #ChosenPlayers < 2 then
if player ~= Sensei then
table.insert(ChosenPlayers, player)
end
end
end
Setup2Players(true, ChosenPlayers)
end
P.S. supposedly Roblox patched the permanent hang issue as far as exploiters not returning anything goes, but they still have the chance to hang by delaying when the client returns a response.
A couple of posts in regards to it from this thread:
Yes, you still should avoid InvokeClient. If you want any semblance of the server wanting data from the client, you can set up a RemoteEvent and do the “round trip” yourself. It also allows you to expect the client to respond with something in a certain time period before raising suspicions about what its doing.