Mezur
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
|
| 13 Dec 2015 07:03 PM |
function onClicked() local h = hit.Parent:findFirstChild("Humanoid") if h == nil then return end local Player = game.Players:GetPlayerFromCharacter(hit.Parent) if (Player ~=nil) then Player.leaderstats.Gold.Value = Player.leaderstats.Gold.Value + 100 end end script.Parent.Touched:connect(onClicked) |
|
|
| Report Abuse |
|
|
Mezur
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
| |
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
| |
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 13 Dec 2015 07:06 PM |
sorry I mis-capitalized
type 'hit' in the () |
|
|
| Report Abuse |
|
|
|
| 13 Dec 2015 07:06 PM |
Sorry my script didn't work out for you, here is a little tip
Make sure if your leaderstats value is ''gold'' to change it to ''gold''
Hope ya get the answer to ur problem. |
|
|
| Report Abuse |
|
|
Mezur
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
|
| 13 Dec 2015 07:07 PM |
I just put "hit" in the ().
Still does not work:
function onClicked(hit) local h = hit.Parent:findFirstChild("Humanoid") if h == nil then return end local Player = game.Players:GetPlayerFromCharacter(hit.Parent) if (Player ~=nil) then Player.leaderstats.Gold.Value = Player.leaderstats.Gold.Value + 100 end end script.Parent.Touched:connect(onClicked) |
|
|
| Report Abuse |
|
|
Mezur
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
|
| 13 Dec 2015 07:08 PM |
| My leaderstats value is "Gold". |
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
| |
|
Mezur
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
|
| 13 Dec 2015 07:10 PM |
| The script is in a part. There is also a clickdetector inside of the part. |
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 13 Dec 2015 07:10 PM |
| The script is not detecting the click detector, it will detect if someone walks into it. |
|
|
| Report Abuse |
|
|
Mezur
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
|
| 13 Dec 2015 07:11 PM |
| It lets me click on the part but i just don't gain any gold.. |
|
|
| Report Abuse |
|
|
Mezur
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
| |
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 13 Dec 2015 07:16 PM |
....
Yes it will let you click because of the click detector, but the script is not linked to the click detector, the script will detect if a player TOUCHES it... hint the . |
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
| |
|
Mezur
|
  |
| Joined: 29 Jun 2015 |
| Total Posts: 3040 |
|
|
| 13 Dec 2015 07:18 PM |
| then how do i link it to the clickdetector |
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 13 Dec 2015 07:19 PM |
function onClicked(player)
end
ClickDetector.MouseClick:connect(onClick) |
|
|
| Report Abuse |
|
|