Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you create multiple entries with text labels?

Asked by 6 years ago
Edited 6 years ago

I have a script that creates a surface gui, then creates a scrollingframe, then creates this textlabel, I want the script to create a textlabel and add Udim2.new(0,0,0,50) to the position each time a player joins. So fair I have just received errors and I have not been able to solve them. I need to access the number of players and multiply that number maybe?

playernum = game.Players.numplayer

function onPlayerRespawned(newPlayer)
    if newPlayer:IsInGroup(groupid) then
local newentry = Instance.new("TextLabel")
newentry.Size = UDim2.new(0,800,0,50)
newentry.Parent = scroll
if
newentry.Position = UDim2.new(0,0,0,0) * playernum
end
newentry.BackgroundColor3 = Color3.new(255,255,255)
newentry.BackgroundTransparency = 0.95
newentry.BorderColor3 = Color3.new(27,42,53)
newentry.BorderSizePixel = 1
newentry.Font = "SourceSans"
newentry.Text = ("["..newPlayer.Name.."]".." | "..newPlayer:GetRoleInGroup(groupid).." | "..newPlayer.AccountAge.." ] ")
newentry.TextColor3 = Color3.new(255,255,255)
newentry.TextSize = 50

    end
    end
 game.Players.PlayerAdded:connect(onPlayerRespawned)

1 answer

Log in to vote
0
Answered by 6 years ago

try this

playernum = game.Players.numplayer

function onPlayerRespawned(newPlayer)
    if newPlayer:IsInGroup(groupid) then
local newentry = Instance.new("TextLabel")
newentry.Size = UDim2.new(0,800,0,50)
newentry.Parent = scroll
newentry.Position = UDim2.new(0,0,0,(50*playernum)-50) 
newentry.BackgroundColor3 = Color3.new(255,255,255)
newentry.BackgroundTransparency = 0.95
newentry.BorderColor3 = Color3.new(27,42,53)
newentry.BorderSizePixel = 1
newentry.Font = "SourceSans"
newentry.Text = ("["..newPlayer.Name.."]".." | "..newPlayer:GetRoleInGroup(groupid).." | "..newPlayer.AccountAge.." ] ")
newentry.TextColor3 = Color3.new(255,255,255)
newentry.TextSize = 50

    end
    end
 game.Players.PlayerAdded:connect(onPlayerRespawned)

(UDim2.new(0,0,0,0) * playernum) is always going to equal 0 because 0*anynumber = 0

Ad

Answer this question