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

This gui/gamepass script is not working??? in my Escape the Art Museum Game

local Players = game:GetService("Players")
local Market = game:GetService("MarketplaceService")

local PassId = 463912717

Players.PlayerAdded:connect(function(User)
if (Market:PlayerOwnsAsset(User ,PassId)) then
	game.ServerStorage.ScreenGui:Clone
	game.ServerStorage.ScreenGui.Parent=User.PlayerGui
	end
end
end)

3 comments

0

Anyone there?

0

Both work, thank you all!

0

You know for FE games, ReplicatedStorage is a better place to store things, especially GUIs

2 answers

✓ Accepted answer

This is how I usually do it:

game.Players.PlayerAdded:connect(function(player)
	if game:GetService("MarketplaceService"):PlayerOwnsAsset(player, 0) -- 0 is the gamepass id
		print(player.Name.." owns the gamepass.")
		local  h = game. ServerStorage['YOUR GUI']:Clone()
		h.Parent = player.PlayerGui
		print('Done!')
	end
end)

Hopefully that helps you out!

**Thanks, ****TopRiot

You did not define a variable for the cloned object.

local Players = game:GetService("Players")
local Market = game:GetService("MarketplaceService")

local PassId = 463912717

Players.PlayerAdded:connect(function(User)
if (Market:PlayerOwnsAsset(User ,PassId)) then
	local clone =   game.ServerStorage.ScreenGui:clone()
    clone.Parent=User.PlayerGui
    end
end
end)

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