Help with strings

So I have this game where there are two types of damages, ranged and melee. Some damages are ranged+ or melee+. I have a string that is either “ranged+” or “melee+”. I want to be able to search in server storage for melee or ranged (depending on what the string is) but without searching for the plus. I can’t just look for ranged+ or melee+ because I don’t know whether it is ranged or melee. How would I detect this?

The problem is that I don’t know the damage type. I want to either find the damage type, or remove the + part of the string to search sever storage.

Forgot about that, try using gsub.

local new = string.gsub('melee+', '+', '')
local something = ServerStorage:FindFirstChild(new)
print(something)
1 Like

It worked! Thank you so much! If you don’t mind, could you explain why you put “++” instead of “+”?

Accidentally put that, feel free to remove it since it’s unnecessary.

Ok so string.gsub(string your editing, what your replacing, what your replacing it with) right?

1 Like