Heya, I’m trying to make a somewhat cool tycoon system, but for some reason, some things ain’t working as should be intended.
I’m having an issue with Functions not doing anything + not giving any print return (Features:TagOre)
There’s no error in the output. nor there is a print from TagOre.
Upgrader Code:
---- UPGRADER CODING
script.Parent.Parent.Upgrader.Touched:Connect(function(Object)
if TycoonMod:IsOre(Object) then
local Ore = TycoonMod:IndentifyOre(Object)
local Config = Ore:GetConfig()
if Ore:CheckTag("BasicUP") then
Ore:TagOre("BasicUP", 0)
Config.Worth.Value *= 2
end
end
end)
Module Code:
function module:IsOre(Object)
if Object:FindFirstChild("Configuration") then
return true
end
return false
end
function module:IndentifyOre(Object)
local Features = {}
if module:IsOre(Object) then
--warn("Object is a ore.")
function Features:GetOre()
return Object
end
function Features:GetConfig()
return Object.Configuration
end
function Features:GetTags()
return Features:GetConfig().Tags
end
function Features:CheckTag(Name)
if Features:GetTags():FindFirstChild(Name) then
return true
end
return false
end
function Features:TagOre(Name: string, valueing: any)
print("Bruh this even work?")
if Features:CheckTag(Name) then
warn("inc value")
Features:GetTags():FindFirstChild(Name).Value = valueing
else
print("AddTag")
local tag = Instance.new("StringValue")
tag.Parent = Features:GetTags()
tag.Value = valueing
end
end
end
print(#Features, game.HttpService:JSONEncode(Features))
return Features
end```