Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Attempt to index nil with 'Price'?

Asked by 2 years ago

It says in the output that i am trying to index nil with price in this, the error is on line 7 help pls.

game.Players.PlayerAdded:Connect (function(player)
    local pg = player:WaitForChild('PlayerGui')
    local Main = pg:WaitForChild('Main')
    for i , v in pairs(Main.PetShop.ScrollingFrame:GetChildren()) do
        if v.Name ~= 'Template' and v:IsA('Frame') then
            v.PetPrice.Text=
game.ReplicatedStorage:WaitForChild('Pets'):FindFirstChild(v.Name).Price.Value
            v.PetName.Text = game.ReplicatedStorage:WaitForChild('Pets'):FindFirstChild(v.Name).Name
        end
    end
end)


0
have you remembered to put a price value in the pet? ISkyLordDoge 37 — 2y
0
yes, i have done that BearGamesZ 4 — 2y
0
Can we see the ReplicatedStorage, please? And make sure the childrens of the Pets are revealed. NotThatFamouss 605 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

instead of:

v.PetPrice.Text=
game.ReplicatedStorage:WaitForChild('Pets'):FindFirstChild(v.Name).Price.Value

do this:

v.PetPrice.Text=
game.ReplicatedStorage:WaitForChild('Pets'):FindFirstChild(v.Name.Price).Value
Ad

Answer this question