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

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

Asked by 8 years ago
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)
0
Anyone there? ethanlaj 5 — 8y
0
Both work, thank you all! ethanlaj 5 — 8y
0
You know for FE games, ReplicatedStorage is a better place to store things, especially GUIs itsJooJoo 195 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago

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

Ad
Log in to vote
0
Answered by
1N0body 206 Moderation Voter
8 years ago
Edited 8 years ago

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)

Answer this question