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

Why cant this script index its own parent?

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?

2 comments

0

Can you show the "Players.world_kiIIer.PlayerGui.rank.Frame.yes.yes" script?

0

that is the script

1 answer

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.

1 comment

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

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