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: Gamepass Script Help???

Previous Thread :: Next Thread 
CrowClaws is not online. CrowClaws
Joined: 04 Jul 2010
Total Posts: 4466
17 Jul 2014 09:58 PM
local Tool = game:FindFirstChild("RegenCoil", true):clone()
local VIPShirt = 163007555
local BadgeService = game:GetService("BadgeService")

game.Players.PlayerAdded:connect(function(Player)
if BadgeService:UserHasBadge(Player.userId, VIPShirt) then
Tool:clone().Parent = Player.StarterGear -- Woops.
Tool:clone().Parent = Player.Backpack -- StarterGear doesn't work on first spawn.
end
end)


Well this works usually. But glitches a lot

Is there a better way to do this.

(It's suppose to give you a certain gear if you own the ID.)
(The Tool is in Lighting)
Report Abuse
DeSpizer27 is not online. DeSpizer27
Joined: 13 Jul 2012
Total Posts: 2679
17 Jul 2014 10:23 PM
local tool = game.Lighting:findFirstChild("RegenCoil")
local id = 163007555
local bs = game:service'BadgeService'

game:service'Players'.PlayerAdded:connect(function(p)
if bs:UserHasBadge(p.userId, id) then
tool:Clone().Parent = p.StarterGear
tool:Clone().Parent = p.Backpack
end
end)
Report Abuse
CrowClaws is not online. CrowClaws
Joined: 04 Jul 2010
Total Posts: 4466
17 Jul 2014 10:41 PM
Isn't that the same script. . . .
Just with shorter Variables...
Report Abuse
Toshi4539 is not online. Toshi4539
Joined: 11 Dec 2008
Total Posts: 210
17 Jul 2014 10:55 PM
Have you tried using WaitForChild() method to delay the script until StarterPack and Backpack arrive?

------------
local Tool = game.Lighting.RegenCoil --if the original tool isnt moving around, just use a simple Object Model reference
local VIPShirt = 163007555
local BadgeService = game:GetService("BadgeService")


function GiveTool(Player)
if BadgeService:UserHasBadge(Player.userId, VIPShirt) then
local spack = Player:WaitForChild("StarterGear")
local t = Tool:clone()
t.Parent = spack
local bpack = Player:WaitForChild("Backpack")
local s = Tool:clone()
s.Parent = bpack
end

game.Players.PlayerAdded:connect(GiveTool)
Report Abuse
DeSpizer27 is not online. DeSpizer27
Joined: 13 Jul 2012
Total Posts: 2679
18 Jul 2014 10:21 AM
@crow You cloned the tool twice, once in the variable and once in the function. I fixed that with my script.
Report Abuse
CrowClaws is not online. CrowClaws
Joined: 04 Jul 2010
Total Posts: 4466
18 Jul 2014 07:19 PM
Oh! Thank you for both of your guys' help!!!
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