alvin1104
|
  |
| Joined: 22 Feb 2011 |
| Total Posts: 681 |
|
|
| 03 May 2014 08:10 AM |
Hi, I have a script that gives players certain tools if they buy a game pass. The script works, but I want it to give the tools when they touch a brick. Could you please edit the script? It is below:
wait(2)
gpid = 155772463 --Game Pass ID tools = {"MegaSword","LinkedPaintballGun","LinkedSlingshot","LinkedTrowel","Superball"} --Put VIP tools in Lighting, then put their exact names here.
------ DON'T EDIT BELOW UNLESS YOU KNOW WHAT YOU'RE DOING
GPS = Game:GetService("GamePassService") function respawned(char) player = game.Players:FindFirstChild(char.Name) print("Respawned") if char:FindFirstChild("Head") ~= nil then print("It's a Player!") if GPS:PlayerHasPass(player, gpid) then print("Has GPID") for i = 1,#tools do game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack end else print("No GPID") end end end game.Workspace.ChildAdded:connect(respawned)
Thank you,
Alvin1104 |
|
|
| Report Abuse |
|
|
nacker
|
  |
| Joined: 06 Oct 2009 |
| Total Posts: 6034 |
|
|
| 03 May 2014 08:14 AM |
| this may not work but you could try changing ChildAdded to MouseClicked and paste the script inside a block with a click detector |
|
|
| Report Abuse |
|
|
alvin1104
|
  |
| Joined: 22 Feb 2011 |
| Total Posts: 681 |
|
|
| 03 May 2014 08:19 AM |
| The thing is though that its a tper to the sf map which give u sword, and if u have pass u get extra too |
|
|
| Report Abuse |
|
|
Aceylos
|
  |
| Joined: 26 Feb 2010 |
| Total Posts: 8266 |
|
|
| 03 May 2014 08:23 AM |
wait(2) -- TouchPart = workspace:WaitForChild("PARTHERE") -- gpid = 155772463 --Game Pass ID tools = {"MegaSword","LinkedPaintballGun","LinkedSlingshot","LinkedTrowel","Superball"} --Put VIP tools in Lighting, then put their exact names here.
------ Script
GPS = Game:GetService("GamePassService")
function PartHit(Hit) player = game.Players:GetPlayerFromCharacter(Hit.Parent) -- if player then if GPS:PlayerHasPass(player, gpid) then print("Has GPID") for i = 1,#tools do game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack end end end end
TouchPart.Touched:connect(PartHit)
|
|
|
| Report Abuse |
|
|
alvin1104
|
  |
| Joined: 22 Feb 2011 |
| Total Posts: 681 |
|
|
| 03 May 2014 08:41 AM |
Thank you!
The only thing is, it gives 2x tool amount?
Alv |
|
|
| Report Abuse |
|
|
Aceylos
|
  |
| Joined: 26 Feb 2010 |
| Total Posts: 8266 |
|
|
| 03 May 2014 08:43 AM |
| Uhh, you could add a debounce to it. Or a check line. |
|
|
| Report Abuse |
|
|
alvin1104
|
  |
| Joined: 22 Feb 2011 |
| Total Posts: 681 |
|
|
| 03 May 2014 08:46 AM |
| How d'ya do that? Sorry for my 'novice' scripting skills. |
|
|
| Report Abuse |
|
|
Aceylos
|
  |
| Joined: 26 Feb 2010 |
| Total Posts: 8266 |
|
|
| 03 May 2014 08:57 AM |
for i = 1,#tools do if player.Backpack:findFirstChild(tools[i])then return end game.Lighting:FindFirstChild(tools[i]):Clone().Parent = player.Backpack end |
|
|
| Report Abuse |
|
|
alvin1104
|
  |
| Joined: 22 Feb 2011 |
| Total Posts: 681 |
|
| |
|