If statement doesn't works on for loop or something went wrong

  1. What do you want to achieve?
    I want to make a RemoteFunction that checks the Folder and creates a value if it find a StringValue with a specified value.

  2. What is the issue?
    i can’t manage the if statement, so it creates values always.

  3. What solutions have you tried so far?
    I have been searching for the solution, but didn’t find anything, that can help me.

There is the code:

local Players = game:GetService("Players");
local RPS = game:GetService("ReplicatedStorage");
local Purchase = RPS:WaitForChild("Remotes").Purchase;

local function GetType(Type)
	if Type == "Emotes" then
		return require(RPS:WaitForChild("Modules").EmotesModule);
	elseif Type == "Weapons" then
		return require(RPS:WaitForChild("Modules").ToolsModule);
	end;
end;

local function GetOwnedValue(loop, Value)
	for _, value in pairs(loop) do
		if value:isA("StringValue") then
			if value.Value == Value  then
				return true;
			end;
		end;
	end
	return false;
end;

local function CreateNewVal(Name, Value, Parent)
	local newVal = Instance.new("StringValue");
	newVal.Name = Name;
	newVal.Value = Value;
	newVal.Parent = Parent;
end;

Purchase.OnServerInvoke = function(Player, Type: string, Value: string)
	local dataBase = Player[Player.UserId];
	local Owned = dataBase["Owned"];
	local Equipped = dataBase["Equipped"];
	
	local leaderstats = Player["leaderstats"];
	local module = GetType(Type);
	
	if module[Value] then
		for _, value in pairs(Owned[Type]:GetChildren()) do
			if value:IsA("StringValue") then
				if value.Value ~= Value then
					CreateNewVal("Check", Value, Owned[Type]);
					break;
				end;
			end;
		end;
	end;
end;

Hope you’ll help me