I have attempted this using string.match, string.gmatch and string.find. The believe the best is string.find.
I want the script to print the players full name from part of their name. As a test I am using my name for an example. This is the script I have.
print(player.Name:find("Craz", 1, true))
This prints 1 4... How can I get this to print the full name?
Doing this is pretty simple, you just need to iterate through all the players in a game, then see which one matches the piece given, then break the for loop when it gets to that name, for example:
local matching for _,plr in pairs(game.Players:GetPlayers()) do if plr.Name:find("Craz") then matching = plr.Name break end end print(matching)
Alternatively, if you want to do this inside the loop, you can do the following:
for _,plr in pairs(game.Players:GetPlayers()) do if plr.Name:find("Craz") then print(plr.Name) break end end
please accept if this helped!