zekey101
|
  |
| Joined: 08 Aug 2011 |
| Total Posts: 2499 |
|
|
| 01 Jun 2016 03:49 AM |
I just simply want the script to get players when they join, recognize if they have the game pass or not, and if they do, unlock the weapon. LIKE NOT SO HARD, BUT I CAN'T GET ANYTHING TO WORK. I even tried the wiki
-------------------- --| WaitForChild |-- --------------------
-- Waits for parent.child to exist, then returns it local function WaitForChild(parent, childName) assert(parent, "ERROR: WaitForChild: parent is nil") while not parent:FindFirstChild(childName) do parent.ChildAdded:wait() end return parent[childName] end
----------------- --| Variables |-- -----------------
local GamePassService = game:GetService('GamePassService') local PlayersService = game:GetService('Players') local InsertService = game:GetService('InsertService') local LightingService = game:GetService('Lighting') --TODO: Use new data store service once that exists
local GamePassIdObject = WaitForChild(script, 'GamePassId') local ToolAssetsToLoad = WaitForChild(script, 'ToolAssetsToLoad')
local function CloneAdminTools(target) for _, tool in pairs(AdminTools:GetChildren()) do local toolClone = tool:Clone() toolClone.Parent = target end end
local function OnPlayerAdded(player) if GamePassService:PlayerHasPass(player, GamePassIdObject.Value) then local gui = WaitForChild(player, 'PlayerGui') print(gui) gui.EOTL.Frame.Ump45.LocalScript.Disabled = false gui.EOTL.Frame.Ump45.Locked:remove() end end
R$ 1,871 |
|
|
| Report Abuse |
|
|
2eggnog
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 1351 |
|
|
| 01 Jun 2016 04:06 AM |
your script is way too complicated. seriously, why are you making your own WaitForChild function when Roblox already has one?
local GamePassId = script:WaitForChild('GamePassId').Value game.Players.PlayerAdded:connect(function(player) if game:GetService("MarketplaceService"):PlayerOwnsAsset(plr,GamePassId) then --do stuff end end)
|
|
|
| Report Abuse |
|
|
2eggnog
|
  |
| Joined: 08 Nov 2008 |
| Total Posts: 1351 |
|
|
| 01 Jun 2016 04:07 AM |
sorry, should be 'player' not 'plr'
|
|
|
| Report Abuse |
|
|
zekey101
|
  |
| Joined: 08 Aug 2011 |
| Total Posts: 2499 |
|
|
| 01 Jun 2016 04:33 AM |
Thanks, kinda first time ever even touching game passes.
R$ 1,871 |
|
|
| Report Abuse |
|
|