I have a Gui with text in it and the text are supposed to follow the value of some int values inside repl. storage, but they dont...

Heres the script

function BackpackLoot()
	wait(1)
	local DeadBackpack = script.Parent.Parent.InteractGui.Adornee.Parent.Name
	StorageItem.Wood.Amount.Text = ReplicatedStorage.PlayerStats[DeadBackpack].Wood.Value
	StorageItem.Cloth.Amount.Text = ReplicatedStorage.PlayerStats[DeadBackpack].Cloth.Value
	StorageItem.Stone.Amount.Text = ReplicatedStorage.PlayerStats[DeadBackpack].Stone.Value
	StorageItem["Raw Metal"].Amount.Text = ReplicatedStorage.PlayerStats[DeadBackpack]["Raw Metal"].Value
	StorageItem.Metal.Amount.Text = ReplicatedStorage.PlayerStats[DeadBackpack].Metal.Value
	StorageItem["Raw Sulfur"].Amount.Text = ReplicatedStorage.PlayerStats[DeadBackpack]["Raw Sulfur"].Value
	StorageItem.Sulfur.Amount.Text = ReplicatedStorage.PlayerStats[DeadBackpack].Sulfur.Value
	StorageItem.Charcoal.Amount.Text = ReplicatedStorage.PlayerStats[DeadBackpack].Charcoal.Value
	StorageItem["Raw Meat"].Amount.Text = ReplicatedStorage.PlayerStats[DeadBackpack]["Raw Meat"].Value
	StorageItem["Cooked Meat"].Amount.Text = ReplicatedStorage.PlayerStats[DeadBackpack]["Cooked Meat"].Value
end

for i,v in pairs(ReplicatedStorage.PlayerStats[script.Parent.Parent.InteractGui.Adornee.Parent.Name]:GetChildren()) do
	v.Changed:Connect(BackpackLoot)
end

script.Parent.Parent.InteractGui.Changed:Connect(BackpackLoot)

The script errors at the top and says DeadBackPack is not member of folder, and I dont understand why it errors but it doesnt work in general anyways.

Any ideas?

2 comments

0

is deadbackpack parented inside of foler?

0

*folder