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

Why cant this script index its own parent?

Asked by 5 years ago

server script:

f = false
script.Parent.MouseButton1Click:Connect(function()
    if not f then
        f = true
    for i,v in pairs(game.Workspace:GetChildren()) do
        if v.Name:match(script.Parent.Parent.Parent.Parent.Parent.Name) then
            local player = game.Players:GetPlayerFromCharacter(v)
            if player.leaderstats.Money.Value >= 15 then
            player.leaderstats.Money.Value = player.leaderstats.Money.Value - 15
            script.Parent.Parent:Destroy()
            end
            end
        end
    end
end)

on line 6 it says

Players.world_kiIIer.PlayerGui.rank.Frame.yes.yes:6: attempt to index field 'Parent' (a nil value)

why does this happen?

0
Can you show the "Players.world_kiIIer.PlayerGui.rank.Frame.yes.yes" script? palame135 44 — 5y
0
that is the script Gameplayer365247v2 1055 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago

Double check your parent directory, the only feasible error is that you're using too many .Parent addresses, and you eventually called for the parent of the game, which is nil.

0
no this is not the case, i printed the parent name when it was lots of .Parent to be sure where i was and on line 6 i refer to the local player Gameplayer365247v2 1055 — 5y
Ad

Answer this question