Hello Developers! I’m trying to do my own admin command and shoertening names, I want do like “:role (short username) (role)” and it changes the Overhead Gui, I’m telling all of you on what I want achive but my goal is do my own admin command with split messages and shoertening names.
I’m trying to do my own admins commands, for that reason I need help with split messages like: “:fire me(player short name)” That is an example of what I’m doing so you can understand better.
I tried searching in the roblox wiki, I found chat things, but I didn’t found anything related or explaining split messages.
Thanks for helping me and taking your time to read this!
Following on from the above message, if you wanted Bant to match BanTech then you can do
local matchedPlayer
for _, player in ipairs( game.Players:GetPlayers() ) do
if player.Name:sub( 1, values[ 2 ]:len() ):lower() == values[ 2 ]:lower() then
if matchedPlayer then
error( 'Oopsie - looks like we matched multiple!' )
end
matchedPlayer = player
end
end
if not matchedPlayer then
error( 'Looks like we did not find anyone' )
end
-- Do stuff with matchedPlayer
Let’s say for example you wanted to change their Team.
If you put :team BanTe Red then with matchedPlayer you’d do matchedPlayer.Team = Teams:FindFirstChild( values[ 3 ] )
after the bit of code I provided in my last reply.
That would put me (or a player in the game with a name starting BanTe) into Team Red (if it exists).
local matchedPlayer
for _, player in ipairs( game.Players:GetPlayers() ) do
if player.Name:sub( 1, values[ 2 ]:len() ):lower() == values[ 2 ]:lower() then
if matchedPlayer then
error( 'Oopsie - looks like we matched multiple!' )
end
matchedPlayer = player
end
end
if not matchedPlayer then
error( 'Looks like we did not find anyone' )
end
matchedPlayer.lowertext.Text "Test Role"
end)
end
end)
end)
Full script:
local values = msg:split(":group Role ")
local matchedPlayer
for _, player in ipairs( game.Players:GetPlayers() ) do
if player.Name:sub( 1, values[ 2 ]:len() ):lower() == values[ 2 ]:lower() then
if matchedPlayer then
error( ‘Oopsie - looks like we matched multiple!’ )
end
matchedPlayer = player
end
end
if not matchedPlayer then
error( ‘Looks like we did not find anyone’ )
end
matchedPlayer.lowertext.Text “Test Role”
end)