How Do I Detect Keywords on Textbox?

I need help to make a script on how do I detect a certain keyword inside of a textbox.
The purpose it: I wanna make a GUI that only can be seen for people in a certain rank in my group.

For example:

  • Group rank = Text

  • Rank 150 = “Fruit Apple”

  • Rank 140 = “Fruit Banana”

  • Rank 100 = “Vehicle Car”

  • Rank 90 = “Vehicle Bike”

If I am on rank 150 in my group, I will be able to see any textbox with the word “Fruit” in it. However, I can’t see textbox that contains the word “Vehicle”.

I don’t know if that make any sense, but I wanna use it for my new project. I have no idea how do I construct this script.

1 Like

you can use

Player:GetRankInGroup(your_group_id)

and just basically do…

local GroupId = urgroupid
local Role = Player:GetRankInGroup(GroupId)

if Role == role then
      blah blah blah
   elseif Role == another role then
        blah blah blah
end

or

local GroupId = urgroupid
local Role = Player:GetRankInGroup(GroupId)
local Roles = {
["role1"] = true,
["role2"] = true
}

if Roles[Role] then
     blah blah blah
end

good luck :+1:

2 Likes

This one work for me. I don’t know why I haven’t thought about using if statement lol. I wanna tried for loops but I think that’s way harder for other people to use my tech. And I wanna make it simple. Thank you sir.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.