I’m currently working on a hosting GUI for my Training Center. I’m wondering how I would script something like the following image. Basically, I want the TextBox to find whichever players’ username is inputted into the TextBox without needing the FULL username. I want it to get the player’s username from the first few letters that are typed in to the TextBox if you get what I mean. The second thing I need this GUI to do is auto-fill the username as PlaceHolderText of the TextBox once it’s found the player with the corresponding username. Keep in mind that I know this isn’t the place to be asking for scripts, but I’ve looked for hours on end and haven’t found anything of assistance with the problem I’m experiencing. Concluding, please let me know if you have the knowledge to provide assistance with this. Thank you all in advance!
local rankButton = script.Parent -- Choose
rankButton.MouseButton1Down:Connect(function()
local characters = string.lower(TextBox.Text) -- Choose
for i, player in pairs(game.Players:GetChildren()) do
local PlrName = string.lower(player.Name)
if string.sub(PlrName,1,#characters) == characters then
-- Code Here (example: player.Rank = "Rank 1"
end
end
end)
Thank you! I’m experiencing an issue and I know why, but I’m not sure how to fix it. Could you provide assistance with this? The script below isn’t working. I need to reference the player’s username in Workspace.
local rankButton = script.Parent.Parent.TextButton
rankButton.MouseButton1Down:Connect(function()
local characters = script.Parent.Text
for i, player in pairs(game.Players:GetChildren()) do
if string.sub(player.Name,1,#characters) == characters then
player.Character.Head.Rank.Frame.Name1.Text = "test"
end
end
end)
local rankButton = script.Parent.Parent.TextButton
rankButton.MouseButton1Down:Connect(function()
local characters = string.lower(script.Parent.Text)
for i, player in pairs(game.Players:GetChildren()) do
local plrName = string.lower(player.Name)
if string.sub(plrName,1,#characters) == characters then
player.Character.Head.Rank.Frame.Name1.Text = "test"
end
end
end)
local rankButton = script.Parent.Parent.TextButton
rankButton.MouseButton1Down:Connect(function()
local characters = string.lower(script.Parent.Text)
for i, player in pairs(game.Players:GetChildren()) do
local plrName = string.lower(player.Name)
if string.sub(plrName,1,#characters) == characters then
script.Parent.Text = player.Name
player.Character.Head.Rank.Frame.Name1.Text = "test"
end
end
end)
Change the script into a local script, make a remote event and fire it in the LocalScript, then make a script to check when remote event is fired and you can rank player.