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: Scripting Help

Previous Thread :: Next Thread 
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
14 Dec 2015 08:03 PM
How do I make something that requires a item and if i touch the part while holding the item it gives me gold (5 gold on leaderstats)
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
14 Dec 2015 08:04 PM
b1
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
14 Dec 2015 08:09 PM
b2
Report Abuse
Wrenly is not online. Wrenly
Joined: 01 Apr 2014
Total Posts: 116
14 Dec 2015 08:10 PM
Workspace.Part.Touched:connect(function()
if Tool.Equipped:connect(function(mouse) then
for _, player in pairs(game.Players:GetPlayers()) do
playerLeaderstats[player]["Money"] = playerLeaderstats[player]["Money"] + 5
if player:FindFirstChild("leaderstats") then
player.leaderstats.Money.Value = playerLeaderstats[player]["Money"]
end
end
end


end)
end)

I dint try this yet tell me if it doesnt work
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
14 Dec 2015 08:32 PM
Do i insert this script into the part i want to touch to gain the money while holding the tool? Also where do i put the tool name?
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
14 Dec 2015 08:35 PM
I did this and it did not work when i had my tool out and touched the part:


Workspace.Part.Touched:connect(function()
if ["Tool hi"].Equipped:connect(function(mouse) then
for _, player in pairs(game.Players:GetPlayers()) do
playerLeaderstats[player]["Gold"] = playerLeaderstats[player]["Gold"] + 5
if player:FindFirstChild("leaderstats") then
player.leaderstats.Money.Value = playerLeaderstats[player]["Gold"]
end
end
end


end)
end)
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
14 Dec 2015 08:36 PM
b3
Report Abuse
Wrenly is not online. Wrenly
Joined: 01 Apr 2014
Total Posts: 116
14 Dec 2015 08:37 PM
change player.leaderstats.Money.Value to player.leaderstats.Gold.Value
and you shouldnt change the tool because it detects whenever any tool is detected already.
also make sure the part you want to click is Workspace.Part and if you have more than one part change the name to like Part1 then Workspace.Part1.Touched:connect(function()
Report Abuse
Mezur is not online. Mezur
Joined: 29 Jun 2015
Total Posts: 3040
14 Dec 2015 08:39 PM
What if i don't want the name of the tool "Tool"? I want the "Tool" to be a different name.. How do i do that
Report Abuse
Wrenly is not online. Wrenly
Joined: 01 Apr 2014
Total Posts: 116
14 Dec 2015 09:09 PM
Bump
Report Abuse
MahouReikon is not online. MahouReikon
Joined: 15 Feb 2014
Total Posts: 1359
14 Dec 2015 09:11 PM
Not saying anything...
Report Abuse
hkep is not online. hkep
Joined: 19 Jul 2014
Total Posts: 550
14 Dec 2015 09:18 PM
local Part = script.Parent;

Part.Touched:connect(function(Hit)
local Char = Hit.Parent;
if Char:FindFirstChild("Humanoid") and Char:FindFirstChild("Tool hi") then
local Player = game.Players:FindFirstChild(Char.Name);
local S = Player.leaderstats.Gold;
S.Value = (S.Value + 5);
end;
end);
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