This is a part of my script to create a gui (like a playerlist but horizontal), for example if 3 people are in the server, the gui should be made 3 times, everything is working fine except that this script is only creating 1 Gui instead of as much as it needs to?
local guitoggle = 0
local x = 0
for i, v in pairs(Players) do
guitoggle = guitoggle+1
if guitoggle == 1 then
x = 0
elseif guitoggle ~= 1 then
x = 107
end
local PlayerFramePositionOffsetX = ((107*guitoggle)-x)
--Creation of PlayerFrame
local PlayerFrame = Instance.new("Frame")
PlayerFrame.Name = v.Name
PlayerFrame.BackgroundTransparency = 1
PlayerFrame.BorderSizePixel = 0
PlayerFrame.Position = UDim2.new(0,0,0,0)
PlayerFrame.Size = UDim2.new(0,100,0,100)
PlayerFrame.Parent = v.PlayerGui.ScreenGui.PlayerPointsFrame
local PlayerImageLabel = Instance.new("ImageLabel")
PlayerImageLabel.BackgroundTransparency = 1
PlayerImageLabel.BorderSizePixel = 0
PlayerImageLabel.ZIndex = 2
PlayerImageLabel.Size = UDim2.new(1,0,1,0)
PlayerImageLabel.Image = redID
PlayerImageLabel.Parent = PlayerFrame
local Name = Instance.new("TextLabel")
Name.BackgroundTransparency = 1
Name.BorderSizePixel = 0
Name.ZIndex = 2
Name.Position = UDim2.new(0,0,0.06,0)
Name.Size = UDim2.new(1,0,0.2,0)
Name.FontSize = "Size60"
Name.TextColor3 = Color3.new(255/255,255/255,255/255)
Name.TextStrokeColor3 = Color3.new(0/255,0/255,0/255)
Name.TextStrokeTransparency = 0
Name.TextWrapped = true
Name.TextScaled = true
Name.Text = v.Name
Name.Parent = PlayerFrame
local Points = Instance.new("TextLabel")
Points.BorderSizePixel = 0
Points.BackgroundTransparency = 1
Points.TextScaled = true
Points.ZIndex = 2
Points.Position = UDim2.new(0,0,0,0)
Points.Size = UDim2.new(1,0,1,0)
Points.FontSize = "Size60"
Points.TextColor3 = Color3.new(255/255,255/255,255/255)
Points.TextStrokeColor3 = Color3.new(0/255,0/255,0/255)
Points.TextStrokeTransparency = 0
Points.TextWrapped = true
Points.Text = "0"
Points.Parent = PlayerFrame
end
end
