Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

A frame is not a valid member of another frame?

Okay, so I have a script that makes a GUI change another GUI's text when clicked on. Here is the script:

local Weights = game.ReplicatedStorage:WaitForChild('Weights')
local Weight = Weights:WaitForChild('Weight25')
local BuyButton = script.Parent

BuyButton.MouseButton1Click:Connect(function()
	local ItemsFolder = game.ReplicatedStorage:WaitForChild('Weights')

	for i,Item in pairs(ItemsFolder:GetChildren())do

		local name = Item.Name
		local price = Item.ShopGuiInfo.Price.Value
		local desc = Item.ShopGuiInfo.Description.Value

	
		local WeightInfoMenu = script.Parent.Parent.Parent.Parent.Parent.WeightsFrame.WeightsMenu.WeightInfoMenu

	local ItemName = WeightInfoMenu.ItemName
		local ItemName =  		script.Parent.Parent.Parent.WeightsFrame.WeightsMenu.WeightInfoMenu.ItemName
		ItemName.Text = 'Test Text'
		print(ItemName.Text)
		local WeightSpeed = WeightInfoMenu.WeightSpeed
		local ItemDesc = WeightInfoMenu:WaitForChild('ItemDescription')
		local WeightPrice =  WeightInfoMenu.WeightPrice
	
	end

end)

Here is my issue. At the line where it says:

localWeightInfoMenu = script.Parent.Parent.Parent.Parent.Parent.WeightsFrame.WeightsMenu.WeightInfoMenu

I am given an error that says:

WeightsFrame is not a valid member of Frame.Players.TheGamerGuy82.PlayerGui.Main.WeightsFrame.WeightsMenu

This script's parents, from top to bottom: Main, WeightsFrame, WeightsMenu, ScrollingFrame, WeightsButton25.

WeightsInfoMenu's parents from top to bottom: Main, WeightsFrame, WeightsMenu.

I am not sure how to fix this as I thought my syntax was correct.

1 answer

Solved this myself! The syntax was wrong, I fixed it by breaking it into two parts.

This discussion is preserved as it was. New answers, comments, and votes are closed.