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
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
| |
|
Mezur
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
| |
|
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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
| |
|
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
|
  |
| 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
|
  |
| Joined: 01 Apr 2014 |
| Total Posts: 116 |
|
| |
|
| |
|
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 |
|
|