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

Why does the in game gamepass shop gui not work?

I am making a gui in my game that allows the player to buy the darkheart gamepass while they are in the game. This is the script:

function gamepass()
script.Parent.Parent.Parent.Parent = player
	Game:GetService("MarketplaceService"):PromptPurchase(player, 155387134)
end

script.Parent.MouseButton1Click:connect(gamepass)

However it does not work when I click the button. Is something missing or incorrect?

1 answer

✓ Accepted answer

The problem is on line two.

script.Parent.Parent.Parent.Parent = player

What that's doing is saying "this script's Parent's Parent's Parent's Parent will be player, which does not currently exists, so instead Parent it to nil"

I believe what you were trying to do was assign player as a variable, in which case the variable name comes first.

player = script.Parent.Parent.Parent.Parent

You may also want to double check your hierarchy, just to be positive you have the correct amount of parents.

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