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 » Scripters
Home Search
 

Re: I'm a noob, help please

Previous Thread :: Next Thread 
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
14 Dec 2015 09:13 PM
I'm trying to make something that if I wear a specific tool and touch a brick, the tool will disappear and I will gain 5 gold on the leader stats. How do I do this?
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
14 Dec 2015 09:14 PM
1
Report Abuse
wonderful72pike is not online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
14 Dec 2015 09:15 PM
Touch a specific brick with the tool?

1) What's the name of the specific brick?
2) Is the stat on the leaderboard called "Gold"?
Report Abuse
MahouReikon is not online. MahouReikon
Joined: 15 Feb 2014
Total Posts: 1359
14 Dec 2015 09:16 PM
Why do I feel like I saw this before use .Touched
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
14 Dec 2015 09:16 PM
The specific name of the brick is called "Dirt" and yes "Gold" is on the leaderboard.
Report Abuse
wonderful72pike is not online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
14 Dec 2015 09:25 PM
Put this in a LocalScript inside of the tool (WARNING: Untested, post if you get any errors)

= = = = = =

local tool = script.Parent
local handle = tool:WaitForChild("Handle")
local player = game.Players.LocalPlayer

function handleTouched(hit)
if hit.Name == "Dirt" then
player.leaderstats.Gold.Value = player.leaderstats.Gold.Value + 5
tool:Destroy()
end
end

= = = = = =
Report Abuse
wonderful72pike is not online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
14 Dec 2015 09:26 PM
WAIT NO, USE THIS ONE INSTEAD:

= = = = = =

local tool = script.Parent
local handle = tool:WaitForChild("Handle")
local player = game.Players.LocalPlayer

function handleTouched(hit)
if hit.Name == "Dirt" then
player.leaderstats.Gold.Value = player.leaderstats.Gold.Value + 5
tool:Destroy()
end
end

handle.Touched:connect(handleTouched)

= = = = = =
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
14 Dec 2015 09:27 PM
I want the tool to be named "Seeds" though
Report Abuse
wonderful72pike is not online. wonderful72pike
Joined: 13 Jul 2010
Total Posts: 7009
14 Dec 2015 09:29 PM
Yeah the tool can be named whatever it wants, as long as the brick it touches is named Dirt.

You can change the name by clicking on the tool in Explorer and changing the Name property in Properties.
Report Abuse
hkep is not online. hkep
Joined: 19 Jul 2014
Total Posts: 550
14 Dec 2015 09:33 PM
local Part = script.Parent;

Part.Touched:connect(function(Hit)
local Char = Hit.Parent;
local Hum,Tool = Char:FindFirstChild("Humanoid"),Char:FindFirstChild("Seeds");
if Hum and Tool then
local Player = game.Players:FindFirstChild(Char.Name);
local S = Player.leaderstats.Gold;
Tool:Destroy();
S.Value = (S.Value + 5);
end;
end);
Report Abuse
hkep is not online. hkep
Joined: 19 Jul 2014
Total Posts: 550
14 Dec 2015 09:34 PM
Put my code in a 'Script' under an object 'Part'.
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
14 Dec 2015 09:35 PM
what do i title the tool though
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
14 Dec 2015 09:37 PM
nvm
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
14 Dec 2015 09:38 PM
it works
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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