Custom Playerlist Issue

Hey Scripters, I have a quick question. I have a LocalScript in my frame; and it’s not cloning my frame.

local UIS = game:GetService("UserInputService")
local SGUI = game:GetService("StarterGui")
local Players = game:GetService("Players")
local Mouse = game.Players.LocalPlayer:GetMouse()

while wait() do
	SGUI:SetCoreGuiEnabled(Enum.CoreGuiType.PlayerList, false)
end

Players.PlayerAdded:Connect(function(plr)
	local Frame = script.Username:Clone()
	Frame.Name = plr.Name
	Frame.Team.Text = plr.Team.Name
	Frame.Username.Text = plr.Name
	Frame.Parent = script.Parent
	print('added player')
	
	while wait() do
		local Found = script.Parent:FindFirstChild(plr.Name)
		if Found then
			Found.Team.Text = plr.Team.Name
		end
	end
end)

Players.PlayerRemoving:Connect(function(plr)
	local Frame = script.Parent:FindFirstChild(plr.Name)
	Frame:Destroy()
end)

UIS.InputBegan:Connect(function(input, gameProcessed)
		if input.KeyCode == Enum.KeyCode.Tab then
		script.Parent.Parent.Visible = not script.Parent.Parent.Visible
		print('tab clicked')
		end
end)

--Mouse.KeyDown:Connect(function(key)
--	if key == Enum.KeyCode.Tab then
--		print('tab clicjked')
--		script.Parent.Parent.Visible = true
--	end
--end)

Why is it not cloning?
(And UIS is not working too)

1 Like

Where is the Script Located
What kind of script is it
Is it even getting past what I quoted.

Like i said, the script is in my frame and it’s a local script. Let me see if it gets past that part ill add a print.

You prob don’t need the while wait() loop, just set it once and delete the loop

Also, I don’t think it can run past the loop

I just did that because my other scripts enables all it and disables all so yeah

That’s what I’m thinking is going on BUT

I’m also pretty sure that this can only be called on the server. I’ll do some research real quick to confirm.

1 Like

If you still want to keep the loop, put it below all of the code

1 Like

I stand corrected

1 Like

I think it can only be called from the server, i’m not getting a print on playeradded because I added it to log it. So I think i should just do a remote event and fire all clients?

Nope, it can be called on client side, if other players join it will work, I have a join message script that works off of that

It won’t call however on your join. Only on other player join

Thus I said, I stand corrected and linked the documentation.
It just didnt work a bit ago newer feature

1 Like

I would remove the while wait() and if you really want a loop to ensure it works wrap it in a pcall or something of that nature

Here you have another while wait() do and it will continue running forever therefore your input not being detected