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: I really need you guys to help me!

Previous Thread :: Next Thread 
alvin1104 is not online. 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 is online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. alvin1104
Joined: 22 Feb 2011
Total Posts: 681
03 May 2014 08:59 AM
THANKS
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