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 pass giver

Previous Thread :: Next Thread 
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
04 Jan 2014 02:05 PM
How do I make a script so that if you buy a game pass and then join the game that you will get a tool automatically which you don't lose upon death?
Report Abuse
SamuelKingx is not online. SamuelKingx
Joined: 27 Jan 2012
Total Posts: 3472
04 Jan 2014 02:18 PM
local GamePassId=0000;
local ToolIndex=Game:GetService('ServerStorage'):FindFirstChild('LinkedSword');
Game['Players']['PlayerAdded']:connect(function(player)
if Game:GetService('MarketplaceService'):PlayerHasPass(player,GamePassID) then
ToolIndex:Clone()['Parent']=player['StarterGear'];
end;
end);

^Try that; I haven't tested it but it should work.
Report Abuse
SamuelKingx is not online. SamuelKingx
Joined: 27 Jan 2012
Total Posts: 3472
04 Jan 2014 02:18 PM
Oh, sorry!

local GamePassId=0000;

should be

local GamePassID=0000;
Report Abuse
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
04 Jan 2014 02:20 PM
Just searched one in models but I just try yours :) thanks
Report Abuse
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
04 Jan 2014 02:21 PM
btw whats diffrence between that two
Report Abuse
SamuelKingx is not online. SamuelKingx
Joined: 27 Jan 2012
Total Posts: 3472
04 Jan 2014 02:22 PM
No problem.(:
Report Abuse
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
05 Jan 2014 05:18 AM
Both which I had did not work, any other scripts? ;s
Report Abuse
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
05 Jan 2014 05:49 AM
bump, the one who gives me a working script gets the game pass for free? :D
Report Abuse
velibor is not online. velibor
Joined: 24 Nov 2009
Total Posts: 1003
05 Jan 2014 05:50 AM
local GamePassId=0000;
local ToolIndex=Game:GetService('ServerStorage'):FindFirstChild('LinkedSword');
Game['Players']['PlayerAdded']:connect(function(player)
if Game:GetService('MarketplaceService'):PlayerOwnsAsset(player,GamePassID) then
ToolIndex:Clone()['Parent']=player['StarterGear'];
end;
end);


Samuel had a wrong method. It is :PlayerOwnsAsset() not :PlayerHasPass(). Please use the Output window if you have such a bug ;)
Report Abuse
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
05 Jan 2014 06:21 AM
I will add it quickly then shower then eat then I will give you the free game pass ;p
Report Abuse
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
05 Jan 2014 06:24 AM
Nope still does not work.
Should I give you the script and the tool, maybe you can fix it then? :$
Or maybe it just does not work for me, but it does for others.
Report Abuse
velibor is not online. velibor
Joined: 24 Nov 2009
Total Posts: 1003
05 Jan 2014 06:31 AM
local GPI = 000 -- Your GamePass Id
local Tool = 'The Name of your Tool' -- Put the Tool in ServerStorage

Game:GetService("Players").PlayerAdded:connect(function(Plr)
if Game:GetService("MarketPlaceService"):PlayerOwnsAsset(Plr, GPI) then
if Game:GetService("ServerStorage"):findFirstChild(Tool) then
local Tool = Game:GetService("ServerStorage"):WaitForChild(Tool)
Tool:Clone().Parent = Player.StarterGear
end
end
end)

That should do the trick. Put this Script in Workspace, put the Tool inside ServerStorage Service..
Report Abuse
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
05 Jan 2014 07:11 AM
Thanks, going to try.
Report Abuse
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
05 Jan 2014 07:16 AM
Still does not work
Report Abuse
VoltiCoil is not online. VoltiCoil
Joined: 20 Nov 2008
Total Posts: 1227
05 Jan 2014 07:19 AM
xD, sorry.
Report Abuse
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
05 Jan 2014 07:42 AM
plsss halp
Report Abuse
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
05 Jan 2014 08:10 AM
umg im desperet
Report Abuse
RoflBread is not online. RoflBread
Joined: 18 Jun 2009
Total Posts: 3803
05 Jan 2014 08:57 AM
.PlayerAdded events don't work in play solo, remember
Report Abuse
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
05 Jan 2014 09:07 AM
I know tried in the game itself, not play solo.
Report Abuse
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
05 Jan 2014 09:38 AM
heeelp
Report Abuse
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
05 Jan 2014 11:48 AM
PLease guys
Report Abuse
LejChris is not online. LejChris
Joined: 28 Dec 2013
Total Posts: 13
05 Jan 2014 01:13 PM
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
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
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
05 Jan 2014 02:14 PM
where do I insert th game pass ID and the tool name?
Report Abuse
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
05 Jan 2014 02:33 PM
If it is here:
local GamePassIdObject = WaitForChild(script, 'GamePassId')
local ToolAssetsToLoad = WaitForChild(script, 'ToolAssetsToLoad')
Then, it still does not work.
Btw the tool is run and its icon is this orange handle with silver brick at it with a script next to it.
Report Abuse
RealistK is not online. RealistK
Joined: 20 Feb 2011
Total Posts: 3489
05 Jan 2014 02:55 PM
halp
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