Attribute and NumberValue not matching up?

i made this watering can tool that basically grow trees, the dirt of the trees are inside the folder “Plants” so i tried using a i, v to call all descendants inside the folder so i can find proximity prompts inside dirt (Workspace > Plants > Dirt > ProximityPrompt)
inside Prompt there are the Tag “Grow” and Attributes “TreeNum”
TreeNum acts as a pattern to which tree to grow first (0> 1 > 2 > 3)

  • inside Plant are dirt that all share the same name “Dirt”
  • proximity are also all called “Prompt”
    (first one had a value of 0 while the other had 2)

it works on the first tree (TreeNum 0) while it does not work on the second tree (TreeNum 1)
and printing currentnum can sometime result in 1 or even 2, 3

i didnt get any error on the output so im stumped, if theres a question please ask away
any help… well helps! :')

local dirt = workspace.Plants
local water = script.Parent.Water.Particle
local currentnum = script.Parent.Times

water.Enabled = false

for i, v in pairs(dirt:GetDescendants()) do
if v:HasTag(“Grow”) then
v.Enabled = false

	if v:GetAttribute("TreeNum") == currentnum.Value then
		script.Parent.Equipped:Connect(function()
			v.Enabled = true
			v.Triggered:Connect(function()
				water.Enabled = true
				wait(5)
				water.Enabled = false
				currentnum.Value += 1
			end)
			
			print("current num ".. currentnum.Value)
			print("attribute ".. v:GetAttribute("TreeNum"))
		end)
		script.Parent.Unequipped:Connect(function()
			v.Enabled = false
		end)
	end
end

end

currentnum.Changed:Connect(function()
print("currentnum is "… currentnum.Value)
end)

can you show me what the console is outputting?

again, there’s no error unfortunately but here’s the output
Capture2

and also here is a video of the output outputting (and to show the file hierarchy too, you may want to pause)

nvm, decided to scrap it. the tree it self are in a different location anyways

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