Even if it works, I have a couple of issues with it. As you can see in the picture, the frame with the player logo and username gets streched. And my other problem, is that after 15 seconds the gui should disappear, but for a reason it doesnt work. If you could help me fix these problem, I would really appreciate it. Thanks. Script will be in an other reply.
local StarterGui = game:GetService("StarterGui")
local TeamsGui = StarterGui.Teams2
local TeamsPlrGui = game.Players.LocalPlayer.PlayerGui.Teams2
local replicated = game.ReplicatedStorage
local redPlrFrame = StarterGui.Teams2.Frame.redFrame.RedPlr
local bluePlrFrame = StarterGui.Teams2.Frame.blueFrame.BluePlr
local starterGui = script.Parent
local xPosition
local xPositionEnd
local function putStats(teamCount, remainingTeamCount, teamNumber)
local frameClone
for i, plr in pairs(teamCount) do
----------------------
print(plr)
if teamNumber == 1 then -- team number 1 indicates the blue team
frameClone = bluePlrFrame:Clone()
xPosition = 0.61
xPositionEnd = 1.1
else -- team number 2 is the red team
frameClone = redPlrFrame:Clone()
xPosition = 0.39
xPositionEnd = -0.1
end
local userId = game.Players:GetUserIdFromNameAsync(plr)
frameClone.name.Text = plr
frameClone.avatar.Image = game.Players:GetUserThumbnailAsync(userId, Enum.ThumbnailType.HeadShot, Enum.ThumbnailSize.Size420x420)
frameClone.Transparency = 0.5
frameClone.Parent = starterGui
frameClone:TweenPosition(UDim2.new(xPosition, 0, 0.25 + (i * (0.075)), 0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.5, false)
wait(0.1)
-------------------------
for i, Rplr in pairs(remainingTeamCount) do
if Rplr then
if plr == Rplr then
frameClone.Transparency = 0
frameClone.Skull.Visible = false
end
else
frameClone.Transparency = 0.5
end
end
end
end
-- removing the stats out of the screen
replicated.TeamsGuiTimer.OnClientEvent:Connect(function(blueTeamCount,remainingBlueTeam, redTeamCount, remainingRedTeam)
print("Showing Teams")
TeamsGui.Enabled = true
TeamsPlrGui.Enabled = true
--local main = replicated.Main:Clone()
--main.Parent = starterGui
--main:TweenPosition(UDim2.new(0.5,0,0.55,0), Enum.EasingDirection.Out, Enum.EasingStyle.Sine, 0.3, false)
putStats(blueTeamCount,remainingBlueTeam,1)
putStats(redTeamCount, remainingRedTeam,2)
wait(15)
TeamsGui.Enabled = false
TeamsPlrGui.Enabled = false
end)