Hi, I am making a Survival Game where the players are in Jurassic World and they have to survive for all in all 9 minutes (there are three "rounds" but they don't do anything really do much besides change the words on the screen and keep track of time). I have two teams, Tourists (survivors) and Casualties (people who died). I want to make a Gui that shows up at the end of each 9-minute game and lists off the names of the players on the Tourists team just like every other survival game has. How would I do this? Thanks, Skyraider5
There are many ways you can do this, but the best way in lua is to create tables for casualties and tourists, and reset them at the end of every round. In order to do this, you would first need to connect the humanoid of every player to the died function, and add them to casualties, if they are found in tourists (you would also need to remove them from tourists) the script for connecting the humanoid is below:
-- This would be a `Server script` in `ServerScriptService` local Tourists = {} -- Making the tourist table if #Tourists == 0 then for i, v in pairs(game.Players:GetPlayers()) do --going through all the players table.insert(Tourists, v.Name) -- Inserting players name into Tourists end elseif #Tourists > 0 then for i, v in pairs(Tourists) do table.remove(Tourists[i]) --[[ Without the line above, on the second round their name would be there twice, so we clear the table and then add all the players again. ]] end for i, v in pairs(game.Players:GetPlayers()) do --going through all the players table.insert(Tourists, v.Name) -- Inserting players name into Tourists end end local Casualties = {} -- Creating Casualties table game.Players.PlayerAdded:Connect(function(plr) -- When a player joins plr.CharacterAdded:Connect(function(char) -- When their character loads char.Humanoid.Died:Connect(function() -- When they die... for i, v in pairs(Tourists) do -- going through all the values in Tourists table if v == char.Name then -- Checking if their name is in there table.insert(Casualties, char.Name) -- if it is, add it to casualties table.remove(Tourists[i]) -- Removing their name from tourists end end end) end) end)
As for making the GUI's at the end of the round, you would have to figure that out yourself, as I can not see your whole game. I wish you luck and hope I helped so far.
-Cmgtotalyawesome