I recently asked a question about a bad argument error when choosing a random player. Now, I want a way to implement a gui into the rest of the players.
Go to: to see this previous question.
This is the current code that has to be updated with this feature:
local playerstorage = game:GetService("Players")
local storage = game:GetService("ServerStorage")
local guifolder = storage.Guis
local players = {}
wait (40)
for _, player in pairs(game.Players:GetPlayers()) do
if player and player.Character then
local humanoid = player.Character:WaitForChild("Humanoid")
if humanoid and humanoid.Health > 0 then
table.insert(players, player)
end
end
end
if #players >= 2 then
local alien = players[math.random(1, #players)]
local alieng = guifolder.Alien
local alieng2 = alieng:Clone()
alieng2.Parent = alien.PlayerGui
alien = script
--More code
else
print '2 players needed!'
end
wait(0.1)

1 comment
Thank you!