Gui appears when you buy the gamepass

Why this script not working. help me fix it please.

local script:

local PassId = 21114743

	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(p.UserId, PassId) then
		p.PlayerGui.InfiniteSkip.Frame.Visible = true
		p.PlayerGui:WaitForChild("InfiniteSkip"):WaitForChild("Frame").Visible = true

local db = true
local skip = game.ReplicatedStorage:WaitForChild("Skip")

Put it in a server script first in ServerScriptService, it doesn’t look like it should be in a local script.

and if i want it local script what do i do?

Why would you want it as a local script?

I agree with Testy, something handling gamepasses and gamepass logic cannot be trusted on a local script because hackermans can easily maniupulate it.

1 Like

never mind its work thank you very much

also in this instance it doesnt work because you are using PlayerAdded, you don’t want to manipulate other ppls guis (not like you can) but a better idea would be to remove the playeradded thing and then do

local p = game.Players.LocalPlayer

at the top

help me when my friend join its doesnt work for me and its work for him.

well, whenever you make a gamepass you automatically own that gamepass. so you would need to test with a different account.