generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Game passes (Script)

Previous Thread :: Next Thread 
dawg1480 is not online. dawg1480
Joined: 19 Aug 2010
Total Posts: 53
26 May 2014 07:19 PM
On one of my places, I have VIP gamepasses, I have it were it gives you starter gear, but once you die, the gear disappears, anyway to fix this?
Report Abuse
cooldude999921 is not online. cooldude999921
Joined: 13 Aug 2011
Total Posts: 3702
26 May 2014 07:21 PM
try CharacterAdded or workspace.ChildAdded and getPlayersFromCharacter
Report Abuse
dawg1480 is not online. dawg1480
Joined: 19 Aug 2010
Total Posts: 53
26 May 2014 07:27 PM
Did all of that, still didn't work. Any other ideas?
Report Abuse
Paramedic4 is not online. Paramedic4
Joined: 23 Jan 2011
Total Posts: 5934
26 May 2014 08:00 PM
Maybe CharacterAdded so to see each time the player respawns if the player has the gamepass
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
26 May 2014 08:32 PM
you placed it in their backpack not their startergear
Report Abuse
dawg1480 is not online. dawg1480
Joined: 19 Aug 2010
Total Posts: 53
26 May 2014 08:52 PM
This is the script, tell what exactly I should fix.. I have the items I want the VIP user to have in a IntValue box(es). I also have the game pass id in a IntValue.

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
local GamePassService = Game:GetService('GamePassService')
local PlayersService = Game:GetService('Players')
local InsertService = Game:GetService('InsertService')
local LightingService = Game:GetService('Lighting')

local GamePassIdObject = WaitForChild(script, 'GamePassId')
local ToolAssetsToLoad = WaitForChild(script, 'ToolAssetsToLoad')

local AdminTools = LightingService:FindFirstChild('AdminTools')


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 starterGear = WaitForChild(player, 'StarterGear')
        CloneAdminTools(starterGear)
        if player.Character then -- They've already loaded and won't get their StarterGear until next spawn
            local backpack = WaitForChild(player, 'Backpack')
            CloneAdminTools(backpack)
        end
    end
end


if not AdminTools then
    AdminTools = Instance.new('Model')
    AdminTools.Name = 'AdminTools'


    for _, intObject in pairs(ToolAssetsToLoad:GetChildren()) do
        if intObject and intObject:IsA('IntValue') and intObject.Value then
            local assetModel = InsertService:LoadAsset(intObject.Value)
            if assetModel then
                local asset = assetModel:GetChildren()[1]
                if asset then
                    asset.Parent = AdminTools
                end
            end
        end
    end

    AdminTools.Parent = LightingService
end

PlayersService.PlayerAdded:connect(OnPlayerAdded)
Report Abuse
robomax11 is not online. robomax11
Joined: 07 Jul 2011
Total Posts: 6828
26 May 2014 08:55 PM
fixxed you need startergear and backpack

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
local GamePassService = Game:GetService('GamePassService')
local PlayersService = Game:GetService('Players')
local InsertService = Game:GetService('InsertService')
local LightingService = Game:GetService('Lighting')

local GamePassIdObject = WaitForChild(script, 'GamePassId')
local ToolAssetsToLoad = WaitForChild(script, 'ToolAssetsToLoad')

local AdminTools = LightingService:FindFirstChild('AdminTools')


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 starterGear = WaitForChild(player, 'StarterGear')
CloneAdminTools(starterGear)
if player.Character then -- They've already loaded and won't get their StarterGear until next spawn
local backpack = WaitForChild(player, 'StarterGear')
local stuff = WaitForChild(player, 'Backpack')
CloneAdminTools(backpack)
CloneAdminTools(stuff)
end
end
end


if not AdminTools then
AdminTools = Instance.new('Model')
AdminTools.Name = 'AdminTools'


for _, intObject in pairs(ToolAssetsToLoad:GetChildren()) do
if intObject and intObject:IsA('IntValue') and intObject.Value then
local assetModel = InsertService:LoadAsset(intObject.Value)
if assetModel then
local asset = assetModel:GetChildren()[1]
if asset then
asset.Parent = AdminTools
end
end
end
end

AdminTools.Parent = LightingService
end

PlayersService.PlayerAdded:connect(OnPlayerAdded)

ˢᶦᵈᵉ ᵉᶠᶠᵉᶜᵗˢ ᵐᵃʸ ᶦᶰᶜᶫᵘᵈᵉ﹕ ᶫᵃᶜᵗᵃᵗᶦᶰᵍ, ʰᵉᵃᵈ ᵉˣᵖᶫᵒᵈᶦᶰᵍ ˢʸᶰᵈʳᵒᵐᵉ, ᵃᶰᵈ ᶫᵒˢˢ ᵒᶠ ᵍᵉᶰiᵗᵃᶫˢ
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
26 May 2014 08:58 PM
my guess was correct
Report Abuse
dawg1480 is not online. dawg1480
Joined: 19 Aug 2010
Total Posts: 53
26 May 2014 09:01 PM
Thanks alot guys. You saved my life. Anyone know how to fix when a minigame ends, and the ambient goes to 255 255 255?
Report Abuse
robomax11 is not online. robomax11
Joined: 07 Jul 2011
Total Posts: 6828
26 May 2014 09:01 PM
those are you scripts, if you care to post them.

ˢᶦᵈᵉ ᵉᶠᶠᵉᶜᵗˢ ᵐᵃʸ ᶦᶰᶜᶫᵘᵈᵉ﹕ ᶫᵃᶜᵗᵃᵗᶦᶰᵍ, ʰᵉᵃᵈ ᵉˣᵖᶫᵒᵈᶦᶰᵍ ˢʸᶰᵈʳᵒᵐᵉ, ᵃᶰᵈ ᶫᵒˢˢ ᵒᶠ ᵍᵉᶰiᵗᵃᶫˢ
Report Abuse
dawg1480 is not online. dawg1480
Joined: 19 Aug 2010
Total Posts: 53
26 May 2014 10:21 PM
Sadly Robo, they didn't work. It didn't reload the gears after I died, is there a chance I would have to wait a certain amount of time before I obtain the gear back?
Report Abuse
LegendaryAccount is not online. LegendaryAccount
Joined: 02 Jun 2010
Total Posts: 13193
26 May 2014 10:26 PM
Check this out
http://www.roblox.com/Gamepass-Weapon-Giver-item?id=115687882
Report Abuse
dawg1480 is not online. dawg1480
Joined: 19 Aug 2010
Total Posts: 53
26 May 2014 10:47 PM
Thank you, that helped!
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image