I want to optimize my code but i dont see how i can put “for” or “collectionservice” here
local DataLoad = game.ReplicatedStorage:WaitForChild("DataLoad")
local plr = game.Players.LocalPlayer
local Folder = plr:WaitForChild("Itens")
local RocksV = script.Parent:WaitForChild("RocksValue")
local CopperV = script.Parent:WaitForChild("CopperValue")
local IronV = script.Parent:WaitForChild("IronValue")
local GoldV = script.Parent:WaitForChild("GoldValue")
local WoodV = script.Parent:WaitForChild("WoodValue")
local WheatV = script.Parent:WaitForChild("WheatValue")
Folder.Rocks.Changed:Connect(function()
RocksV.Text = Folder.Rocks.Value
end)
Folder.Coppers.Changed:Connect(function()
CopperV.Text = Folder.Coppers.Value
end)
Folder.Irons.Changed:Connect(function()
IronV.Text = Folder.Irons.Value
end)
Folder.Golds.Changed:Connect(function()
GoldV.Text = Folder.Golds.Value
end)
Folder.Woods.Changed:Connect(function()
WoodV.Text = Folder.Woods.Value
end)
Folder.Wheats.Changed:Connect(function()
WheatV.Text = Folder.Wheats.Value
end)
DataLoad.OnClientEvent:Connect(function()
RocksV.Text = Folder.Rocks.Value
CopperV.Text = Folder.Coppers.Value
IronV.Text = Folder.Irons.Value
GoldV.Text = Folder.Golds.Value
WoodV.Text = Folder.Woods.Value
WheatV.Text = Folder.Wheats.Value
end)