Textlabel not visible

game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(playerlist, playernumber)
	local textlabel = game.ReplicatedStorage.TextLabel
	textlabel.Size = UDim2.new(0,221,0,50)
	for i = 1, playernumber do
		print("looped")
		local clonedtxt = textlabel:Clone()
		clonedtxt.Parent = game.StarterGui.ScreenGui.ScrollingFrame.PlayerList
		clonedtxt.Position = UDim2.new(0, 0, 0.04*(i-1) ,0)
		clonedtxt.Text = "Test"
	end
end)

the visible property is turned on btw

kfjklasdgjasjgldl;nlcnb

Put a print() right after the RemoteEvent got fired, to see if the event actually gets fired first.

game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(playerlist, playernumber)
    print("fired")
    local textlabel = game.ReplicatedStorage.TextLabel
    ...

sdafsgsadf
it prints looped so i dont think thats the problem

Why are you cloning a piece of text from ReplicatedStorage? Can’t you just create a text label, to then set the Visible property to true?

game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(playerlist, playernumber)
	local textlabel = Instance.new("TextLabel")
	textlabel.Size = UDim2.new(0,221,0,50)
	for i = 1, playernumber do
		print("looped")
		local clonedtxt = textlabel:Clone()
		clonedtxt.Parent = game.StarterGui.ScreenGui.ScrollingFrame.PlayerList
		clonedtxt.Position = UDim2.new(0, 0, 0.04*(i-1) ,0)
		clonedtxt.Text = "Test"
	end
	local playerlist = script.Parent.PlayerList:GetChildren()
end)

I fixed the code but it still doesnt work

Can you send a screenshot of the hierarchy? Are there any gui elements above it that have ClipsDescendents on, or is it being parented to something that’s not visible?


clipsdescendents is turned off

Run the script, as usual, then check if the Text actually exists in the Explorer, seeing if the script works.


its inside the folder

UI elements aren’t meant to be parented inside the folder. Try parenting the TextLabel somewhere else.

Can you try parenting it to the scrollingframe instead of the folder? It should still show theoretically but the behavior might not be what you expect.

game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function(playerlist, playernumber)
	local textlabel = Instance.new("TextLabel")
	textlabel.Size = UDim2.new(0,221,0,50)
	for i = 1, playernumber do
		print("looped")
		local clonedtxt = textlabel:Clone()
		clonedtxt.Parent = game.StarterGui.ScreenGui.ScrollingFrame
		clonedtxt.Position = UDim2.new(0, 0, 0.04*(i-1) ,0)
		clonedtxt.Text = "Test"
	end
end)

Can you send a screenshot of the TextLabel’s attributes? Is it possible that the texttransparency and the backgroundtransparency are set to 1?

Try messing with the attributes in game, too, and see if you can get anything to show. It looks like it should be there.

oh – I just noticed.

In your script, you have it parenting the clone to StarterGui instead of the PlayerGui. That would not replicate to the player as their UI is in Players.[player].PlayerGui. Check your Player in the Players tab up below Workspace and see if it’s being properly displayed there. You’re likely just looking at the PlayerGui before it gets replicated to the player.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.