Hey there!
So for my game i need an Intermission GUI, consisting of the following values:
-
Shows any player that has fired a remote event (‘Play’ button)
-
Removes any player that has fired a remote event (‘Back’ button)
-
Shows Player’s name and icon
-
Adds players in order
-
Shifts all player’s frames when a player leaves in order
So everything works except from the fifth value.
Here’s an image of what it looks like when everyone in the game presses play:
The code is a little weak and unprofessional but it works just fine.
However, when a player (player 2 in this case) does go back to the main menu, this happens:
.Here’s the code:
local PlayerIntFrame1 = script.Parent:FindFirstChild("PlayerIntFrame1")
local PlayerIntFrame2 = script.Parent:FindFirstChild("PlayerIntFrame2")
local PlayerIntFrame3 = script.Parent:FindFirstChild("PlayerIntFrame3")
local PlayerIntFrame4 = script.Parent:FindFirstChild("PlayerIntFrame4")
local PlayerIntFrame5 = script.Parent:FindFirstChild("PlayerIntFrame5")
local PlayerIntFrame6 = script.Parent:FindFirstChild("PlayerIntFrame6")
game.ReplicatedStorage.PlayerAddedIntermission.OnClientEvent:Connect(function(player)
if PlayerIntFrame1.Visible == false then
PlayerIntFrame1.Visible = true
PlayerIntFrame1.Name = player.Name
PlayerIntFrame1.PlayerName.Text = player.Name
PlayerIntFrame1.PlayerImage.Image = game.Players:GetUserThumbnailAsync(player.UserId,Enum.ThumbnailType.HeadShot,Enum.ThumbnailSize.Size420x420)
elseif PlayerIntFrame2.Visible == false then
PlayerIntFrame2.Visible = true
PlayerIntFrame2.Name = player.Name
PlayerIntFrame2.PlayerName.Text = player.Name
PlayerIntFrame2.PlayerImage.Image = game.Players:GetUserThumbnailAsync(player.UserId,Enum.ThumbnailType.HeadShot,Enum.ThumbnailSize.Size420x420)
elseif PlayerIntFrame3.Visible == false then
PlayerIntFrame3.Visible = true
PlayerIntFrame3.Name = player.Name
PlayerIntFrame3.PlayerName.Text = player.Name
PlayerIntFrame3.PlayerImage.Image = game.Players:GetUserThumbnailAsync(player.UserId,Enum.ThumbnailType.HeadShot,Enum.ThumbnailSize.Size420x420)
elseif PlayerIntFrame4.Visible == false then
PlayerIntFrame4.Visible = true
PlayerIntFrame4.Name = player.Name
PlayerIntFrame4.PlayerName.Text = player.Name
PlayerIntFrame4.PlayerImage.Image = game.Players:GetUserThumbnailAsync(player.UserId,Enum.ThumbnailType.HeadShot,Enum.ThumbnailSize.Size420x420)
elseif PlayerIntFrame5.Visible == false then
PlayerIntFrame5.Visible = true
PlayerIntFrame5.Name = player.Name
PlayerIntFrame5.PlayerName.Text = player.Name
PlayerIntFrame5.PlayerImage.Image = game.Players:GetUserThumbnailAsync(player.UserId,Enum.ThumbnailType.HeadShot,Enum.ThumbnailSize.Size420x420)
elseif PlayerIntFrame6.Visible == false then
PlayerIntFrame6.Visible = true
PlayerIntFrame6.Name = player.Name
PlayerIntFrame6.PlayerName.Text = player.Name
PlayerIntFrame6.PlayerImage.Image = game.Players:GetUserThumbnailAsync(player.UserId,Enum.ThumbnailType.HeadShot,Enum.ThumbnailSize.Size420x420)
else
print("Error: PlayerIntFrame'LocalScript'")
end
end)
game.ReplicatedStorage.PlayerRemovedIntermission.OnClientEvent:Connect(function(player)
local PlayerIntFrame = script.Parent:FindFirstChild(player.Name)
PlayerIntFrame.Visible = false
PlayerIntFrame.PlayerImage.Image = "rbxassetid://3570695787"
PlayerIntFrame.PlayerName.Text = "ITS ME"
PlayerIntFrame.Name = "PlayerIntFrame"..PlayerIntFrame.Value.Value
if PlayerIntFrame.Name == "PlayerIntFrame1" then
local Position = PlayerIntFrame6.Position
PlayerIntFrame6.Position = PlayerIntFrame5.Position
PlayerIntFrame5.Position = PlayerIntFrame4.Position
PlayerIntFrame4.Position = PlayerIntFrame3.Position
PlayerIntFrame3.Position = PlayerIntFrame2.Position
PlayerIntFrame2.Position = PlayerIntFrame1.Position
PlayerIntFrame1.Position = Position
elseif PlayerIntFrame.Name == "PlayerIntFrame2" then
local Position = PlayerIntFrame5.Position
PlayerIntFrame5.Position = PlayerIntFrame4.Position
PlayerIntFrame4.Position = PlayerIntFrame3.Position
PlayerIntFrame3.Position = PlayerIntFrame2.Position
PlayerIntFrame2.Position = PlayerIntFrame1.Position
PlayerIntFrame1.Position = PlayerIntFrame6.Position
PlayerIntFrame6.Position = PlayerIntFrame5.Position
elseif PlayerIntFrame.Name == "PlayerIntFrame3" then
local Position = PlayerIntFrame4.Position
PlayerIntFrame4.Position = PlayerIntFrame3.Position
PlayerIntFrame3.Position = PlayerIntFrame2.Position
PlayerIntFrame2.Position = PlayerIntFrame1.Position
PlayerIntFrame1.Position = PlayerIntFrame6.Position
PlayerIntFrame6.Position = PlayerIntFrame5.Position
PlayerIntFrame5.Position = Position
elseif PlayerIntFrame.Name == "PlayerIntFrame4" then
local Position = PlayerIntFrame3.Position
PlayerIntFrame3.Position = PlayerIntFrame2.Position
PlayerIntFrame2.Position = PlayerIntFrame1.Position
PlayerIntFrame1.Position = PlayerIntFrame6.Position
PlayerIntFrame6.Position = PlayerIntFrame5.Position
PlayerIntFrame5.Position = PlayerIntFrame4.Position
PlayerIntFrame4.Position = Position
elseif PlayerIntFrame.Name == "PlayerIntFrame5" then
local Position = PlayerIntFrame2.Position
PlayerIntFrame2.Position = PlayerIntFrame1.Position
PlayerIntFrame1.Position = PlayerIntFrame6.Position
PlayerIntFrame6.Position = PlayerIntFrame5.Position
PlayerIntFrame5.Position = PlayerIntFrame4.Position
PlayerIntFrame4.Position = PlayerIntFrame3.Position
PlayerIntFrame3.Position = Position
elseif PlayerIntFrame.Name == "PlayerIntFrame6" then
local Position = PlayerIntFrame1.Position
PlayerIntFrame1.Position = PlayerIntFrame6.Position
PlayerIntFrame6.Position = PlayerIntFrame5.Position
PlayerIntFrame5.Position = PlayerIntFrame4.Position
PlayerIntFrame4.Position = PlayerIntFrame3.Position
PlayerIntFrame3.Position = PlayerIntFrame2.Position
PlayerIntFrame2.Position = Position
else
print("Error: PlayerIntFrame'LocalScript'")
end
end)
If i use a UIGradient, the players’ frame sizes are messed up on different devices.
As you can see i’m not the best at scripting.
Any help would be appreciated!