(Admin Panel GUI) Where is my mistake? Which one is better?

Hello readers,

I am Anthony. I am having problems with Admin Panel GUI for Military Group. I need your help to find the error and/or pick which one is better. I am open for any questions! Poll is below too!

About Me

I am Anthony or also known as AlertShamrock. I am still pretty new scripter, good builder. (We all have our opinions) I own a ROBLOX Military group. I hate making UI, but I don’t care if I need to.

Army link

https://www.roblox.com/groups/4371823/US-United-States-Army

Autocomplete player list
Problem

I am trying make it autofill while trying the letters any ideas?
I know I need another textbox behind it for it work. But I don’t know how to script it, any good tutorials or scripts for it?

UI

image

Script

None I am lost.

Player list menu
Problem

When you click the button it will copy the text and move a value text string, for a discord webhook. But it’s not working.

UI/GUI

image

Script

function onclick()
script.Parent.Parent.Parent.p2.Value = script.Parent.Text
end
script.Parent.MouseButton1Down:Connect(onclick)

  • Autocomplete username Textbox
  • Player list Menu

0 voters

Regardless,
Anthony

7 Likes

Honestly, depends on your setup, both can be very easy. Even with keeping the scrolling frame.

Search Player Method
You can use the on changed event, to grab the text and take its length, use that and run it against all players usernames in the server, if the strings are the same then it will return the player that contains the begging of that username. Here is some code that I made that does it.

local selected = "none";
function findPlayersByShortCode(shrot)
    local plrs = {};
    for a,b in pairs (game.Players:GetPlayers()) do
        if string.sub(string.lower(b.Name), 1, string.len(shrot)) == string.lower(shrot) then
            table.insert(plrs, b)
        end
    end
    return plrs
end

textBox.Changed:Connect(function()
	local selected="none";
	local players = findPlayersByShortCode(textBox.Text)
	--to do add event for player added/removed
	for index, player in pairs (players) do
	    local clone = button:Clone()--make a button
	    local sizeInY = 200;--use offset, don't use percentages, it'll mess up when you make the scrolling frame bigger.
	    clone.Parent = scrollingFrame;--update this
	    clone.Position = UDim2.new(0,0,0,(index-1)*sizeInY)
	    scrollingFrame.CanvasSize = UDim2.new(0,0,0,(index-1)*sizeInY);
	    clone.Text = player.Name;
	    clone.OnMouseButton1Down:Connect(function()
	        selected=player;
	    end)
	end
end)

Select Player Name

local selected="none";
local players = game.Players:GetPlayers();
--to do add event for player added/removed
for index, player in pairs (players) do
    local clone = button:Clone()--make a button
    local sizeInY = 200;--use offset, don't use percentages, it'll mess up when you make the scrolling frame bigger.
    clone.Parent = scrollingFrame;--update this
    clone.Position = UDim2.new(0,0,0,(index-1)*sizeInY)
    scrollingFrame.CanvasSize = UDim2.new(0,0,0,(index-1)*sizeInY);
    clone.Text = player.Name;
    clone.OnMouseButton1Down:Connect(function()
        selected=player;
    end)
end
--then do something with player

Wrote this on my phone, excuse any mistakes. If you need anything else, hit me up!

3 Likes

First, that must be hard via phone. I will try them!

1 Like

It is. You will have to change a view things to make sure it works! if it works, don’t forget to make it the solution :stuck_out_tongue: if it doesn’t tell me and I’ll try and go fix things.

@sloss2003 1/2 works. The Player menu works. Some errors, But, I fixed them. The autocomplete username textbox doesn’t work, or I may just be dumb. But, Thank you!

local selected=“none”;
local players = game.Players:GetPlayers();
–to do add event for player added/removed
for index, player in pairs (players) do
local clone = button:Clone()–make a button
local sizeInY = 200;–use offset, don’t use percentages, it’ll mess up when you make the scrolling frame bigger.
clone.Parent = scrollingFrame;–update this
clone.Position = UDim2.new(0,0,0,(index-1)*sizeInY)
scrollingFrame.Size= UDim2.new(0,0,0,(index-1)*sizeInY);
clone.Text = player.Name;
clone.OnMouseButton1Down:Connect(function()
selected=player;
end)
end

It does work. But, when it’s selected it need to change value of the string for the Discord Webhook.

It should be pretty easy, just set the varible. Selected is the player, and if it is “none”, well then you need to do something to tell the client, that player doesn’t exist.

So this will work?

script.Parent.Parent.p2.Value = selected

local selected=“none”;
local players = game.Players:GetPlayers();
–to do add event for player added/removed
for index, player in pairs (players) do
local clone = button:Clone()–make a button
local sizeInY = 200;–use offset, don’t use percentages, it’ll mess up when you make the scrolling frame bigger.
clone.Parent = scrollingFrame;–update this
clone.Position = UDim2.new(0,0,0,(index-1)*sizeInY)
scrollingFrame.Size= UDim2.new(0,0,0,(index-1)*sizeInY);
clone.Text = player.Name;
clone.OnMouseButton1Down:Connect(function()
selected=player;
script.Parent.Parent.p2.value = selected.text
end)
end

Or this one?

local selected=“none”;
local players = game.Players:GetPlayers();
–to do add event for player added/removed
for index, player in pairs (players) do
local clone = button:Clone()–make a button
local sizeInY = 200;–use offset, don’t use percentages, it’ll mess up when you make the scrolling frame bigger.
clone.Parent = scrollingFrame;–update this
clone.Position = UDim2.new(0,0,0,(index-1)*sizeInY)
scrollingFrame.Size= UDim2.new(0,0,0,(index-1)*sizeInY);
clone.Text = player.Name;
clone.OnMouseButton1Down:Connect(function()
selected=player;
end)
end
script.Parent.Parent.p2.value = selected.text

Change
script.Parent.Parent.p2.Value = selected
to
script.Parent.Parent.p2.Value = selected.Name -- you can also do player id by using: UserId

Still not working.

Code:

local selected=“none”;
local players = game.Players:GetPlayers();
local n = script.Parent
–to do add event for player added/removed
for index, player in pairs (players) do
local clone = n.slots.Template:Clone()–make a button
local sizeInY = 200;–use offset, don’t use percentages, it’ll mess up when you make the scrolling frame bigger.
clone.Parent = n;–update this
clone.Position = UDim2.new(0,0,0,(index-1)*sizeInY)
n.Size = UDim2.new(0.9, 0,0.5,(index-1)*sizeInY);
clone.Text = player.Name;
clone.MouseButton1Down:Connect(function()
selected=player
script.Parent.Parent.p2.Value = selected.Name
end)
end

Any errors? What’s happening?

cmon thirty characters

it’s not changing the string value.

are you testing in studio? if so make sure your going to players.[username].PlayerGui.[location of string value]

Wait… I was looking under Startergui.

Works! I was looking under the wrong area.

1 Like

You have a lot of folds and unnecessary information in this thread which make it annoying to read. Could you please focus on one thing at a time? Helping debugging your code after attempting to do so yourself first can be one thread here and asking for design tips should be a separate thread in #development-support:game-design-support.

1 Like

Dear @ScriptingSupport,

I am sorry that I made you feel that way. I work harder to make feel less annoyed while reading my post/forms. I asked help for scripting not all for voting. Thirdly, I must’ve forgotten to add the code in this post that I had before, it was horrible. I asked for help on the player list not sending the text to a value but, @sloss2003 (Sorry for Mention) solved, bad code and value at once. If @sloss2003 (Sorry for mention again) feel like I used him, I am sorry that treated that way. I didn’t mean to use anyone, I am just a bad at scripting, I am learning every day. So if you any other suggestions to fix what I am doing please let me know!

Regardless,
Anthony

You didn’t use me, it’s okay; nothing to be sorry about. I enjoy helping.

1 Like