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: An anti-tool spam giver? (SEE TO UNDERSTAND)

Previous Thread :: Next Thread 
wazicampagain is not online. wazicampagain
Joined: 18 Aug 2010
Total Posts: 5127
08 Oct 2012 12:21 AM
Where can I find a model where if you touch/click it, it gives you a tool, and if you want it to give you something again, it will delete your recently given tool to prevent inventory spam?
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
08 Oct 2012 12:45 AM
Make it check the player's backpack to see if they have the tool.
If they do own it, destroy it.

Ex.

local tool,tool_name = game.Lighting["TOOLNAME"],tool.Name

script.Parent.Touched:connect(function(hit)
local plyr = tool:clone().Parent = game.Players:GetPlayerFromCharacter(hit.Parent)
if plyr and plyr.Backpack:FindFirstChild(tool_name) then
plyr.Backpack:FindFirstChild(tool_name):Destroy()
tool:clone().Parent = plyr.Backpack
else
tool:clone().Parent = plyr.Backpack
end
end
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
08 Oct 2012 12:45 AM
Woops! Forgot the ending parenthesis.

local tool,tool_name = game.Lighting["TOOLNAME"],tool.Name

script.Parent.Touched:connect(function(hit)
local plyr = tool:clone().Parent = game.Players:GetPlayerFromCharacter(hit.Parent)
if plyr and plyr.Backpack:FindFirstChild(tool_name) then
plyr.Backpack:FindFirstChild(tool_name):Destroy()
tool:clone().Parent = plyr.Backpack
else
tool:clone().Parent = plyr.Backpack
end
end)
Report Abuse
wazicampagain is not online. wazicampagain
Joined: 18 Aug 2010
Total Posts: 5127
08 Oct 2012 12:59 AM
Gee, thanks! :D
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