I am making my private give cash GUI which gives cash to player. It is so I or the player can get enough cash to test the items I am adding.
I always have to type the full name of the target player. I know it is possible to make a script which only requires you to type only first part of the name of the target player.
How can I do this? Please tell me. Like in admin commands you don't have to type the full name.
How can I do that? Please tell me, with an example(if you can give) as I understand much more by looking at an example.
Thanks!
To accomplish this, we have to utilize :sub()
. We simply split the name of the player into the length of the text we already have, and we check if the remaining text is equal.
local message --lets say this equals a chat message, in the case of admin commands for _,v in pairs(game:GetService("Players"):GetPlayers()) do if v.Name:lower():sub(1,message:len()) == message:lower() then --lower and split as needed print("Found Target(s)") end end