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 |
|
|
|
| 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
|
  |
| 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
|
  |
| 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 |
|
|
|
| 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
|
  |
| Joined: 04 Jul 2010 |
| Total Posts: 4466 |
|
|
| 18 Jul 2014 07:19 PM |
| Oh! Thank you for both of your guys' help!!! |
|
|
| Report Abuse |
|
|