I want to check if a string is a valid game instance: (for some random change part color by user inputs the path)
local path = "game.Workspace.Baseplate" -- returns true
local path = "this is not a instance" -- returns false
local path = "game.Workspace.thispartdoesntexist" -- returns false
I used a pattern check to check if the string is valid instance pattern
Script:
local pattern = 'Workspace%..'
local pattern2 = 'game[%.]Workspace%..'
if string.match(str, pattern) or string.match(str, pattern2) then
print("yes")
else
print("nooo")
end
Now I don’t know how to check if the path is in game or not