Why This Script Doesn't Works?

This is a support category for asking questions about how to get something done on the Roblox websites or how to do something on Roblox applications such as Roblox Studio.

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

I want to achieve when a player joins the game it clones a frame that shows player informations ( like profile image, name). And I Want To It Clones All Players Who Joined The Game.

  1. What is the issue? Include screenshots / videos if possible!

It Works But It Only Clones The Last Player.

The Code I Used

local admins = {'ailtorpak79', 'Player1'}

local position = UDim2.new(0.015, 0, 0, 5)
local positionadd = UDim2.new(0, 0, 0, 130)

game.Players.PlayerAdded:Connect(function(player)
	local playerframe = game:GetService('StarterGui')["Umid's Admin Panel"].PanelFrame.Players.PlayerFrameExample
	
	local thumbnailtype = Enum.ThumbnailType.HeadShot
	local thumbnailsize = Enum.ThumbnailSize.Size100x100
	
	local thumbnailimage = game:GetService('Players'):GetUserThumbnailAsync(player.UserId, thumbnailtype, thumbnailsize)
	
	for _, v in pairs(game:GetService('Players'):GetPlayers()) do
		if table.find(admins, v.Name) ~= nil then
			for _, players in pairs(game:GetService('Players'):GetPlayers()) do
				playerframe:Clone()
				playerframe.Parent = v.PlayerGui:WaitForChild("Umid's Admin Panel").PanelFrame.Players
				playerframe.Name = players.Name

				playerframe.Position = position

				playerframe.Visible = true

				playerframe.ProfileImage.Image = thumbnailimage

				playerframe.NameText.Text = players.Name

				position += positionadd
			end
		end
	end
end)

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I Tried To Do It In A Loop With For _, players in pairs() do but it didn’t work.

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

And There Is No Errors Or Warnings In The Output.

This belongs to Scripting Support, you might want to move the topic to that category
Anyways,

You aren’t modifying the properties of the clone you made, but rather the existing one in StarterGui, therefore only showing the info of the last player the script changed properties on. You need to do this instead:

local clone = playerframe:Clone()
				clone.Parent = v.PlayerGui:WaitForChild("Umid's Admin Panel").PanelFrame.Players
				clone.Name = players.Name

				clone.Position = position

				clone.Visible = true

				clone.ProfileImage.Image = thumbnailimage

				clone.NameText.Text = players.Name

Thanks! It Worked.And Sorry For Posting In Wrong Topic.I Am New,So I Didn’t Know.I Changed It Now.

1 Like

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