Hello.
I am trying to make a round system for one of my games, and I want to make it like the one that’s features in Legends Of Speed.
I tried to make one but it failed. I don’t have any sample scripts for this, sorry!
Anything helps, thanks!
Hello.
I am trying to make a round system for one of my games, and I want to make it like the one that’s features in Legends Of Speed.
I tried to make one but it failed. I don’t have any sample scripts for this, sorry!
Anything helps, thanks!
Are you talking about making the race countdown/rounds?
Remote Event or Bindable event.
If its a remote event then
Will have to be changed to either FireServer
, FireClient
or FireAllClients
and
Would have to be changed to either OnServerEvent
or OnClientEvent
Sorry for a very late reply - but no. I want to make the beginning part, where the player has the option to participate, then, it goes into a round with only the players that clicked on ‘yes’ or something like that.
You can do this by:
First, if a player presses on the “Yes” button then add that player on a table like
local playersForThisMatch = {}
yesButtonEvent.OnServerEvent:Connect(function(player)
--Dictionary Type
if not playersForThisMatch[player] then
playersForThisMatch[player] = true
end
-- Array Type
if not table.find(playersForThisMatch, player) then
table.insert(playersForThisMatch, player) then
end
end)
Next is by checking the players on that table and teleporting them when the countdown ends
-- Dictionary Type
for player, v in pairs (playersForThisMatch) do
if game.Players:FindFirstChild(player.Name) then
-- teleport that player
end
end
-- Array Type
for i, player in pairs (playersForThisMatch) do
if game.Players:FindFirstChild(player.Name) then
-- teleport that player
end
end
And finally clearing the table when the matches end
roundFinishedEvent:Connect(function()
-- or teleport the players back in the main map before clearing the table by
--doing the 2nd step; just teleporting back to the main map
table.clear(playersForThisMatch)
end
thats all