Log in to vote

A frame is not a valid member of another frame?

Asked by 7 days ago

This question has been solved by the original poster.

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

    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'
        local WeightSpeed = WeightInfoMenu.WeightSpeed
        local ItemDesc = WeightInfoMenu:WaitForChild('ItemDescription')
        local WeightPrice =  WeightInfoMenu.WeightPrice



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

Log in to vote
Answered by 7 days ago

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


Answer this question