Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to check if a player's name contains a given phrase?

Asked by 2 years ago

I had a big problem with this and messed it up so badly that I don't know why I decided to delete the entire script, now I want to do it lustfully.

After joining the player's server, I want the server to check if the player's name contains a given phrase. np."NotFound" or "DreamStan".If the player contains phrases, then print "Something"

I don't really need the entire script (unless it's simple), I just need an article on this topic or a tutorial and what script to place

Sorry to everyone I don't have any script but they blocked me on DevHub and I have nobody to ask for help (because I have no friends)

0
string.find would be the function you'd use Rinpix 639 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

You can use string.find

game.Players.PlayerAdded:Connect(function(plr)
    if string.find(plr.Name, 'DreamStan') or string.find(plr.Name,'NotFound') then
        print('ok')

    end


end)

You can also do


game.Players.PlayerAdded:Connect(function(plr) local lower = plr.Name:lower() if lower:find('dreamstan') or lower:find('notfound') then print('ok') end end)
0
dream stans when they realize that dream is actually slenderman with a mask greatneil80 2647 — 2y
Ad

Answer this question