|
| 23 Dec 2014 11:05 AM |
script.Parent.Touched:connect(function(player) if player:FindFirstChild("leaderstats") then if player.leaderstats.Money.Value>4 then player.leaderstats.Money.Value=player.leaderstats.Money.Value-5 end end end)
This script does not work(and yes I did make the leaderstats) |
|
|
| Report Abuse |
|
|
|
| 23 Dec 2014 11:07 AM |
| Look at the parameters for the "Touched" event of BasePart. |
|
|
| Report Abuse |
|
|
| |
|
Qivr
|
  |
| Joined: 22 Aug 2014 |
| Total Posts: 5407 |
|
|
| 24 Dec 2014 02:40 AM |
script.Parent.Touched:connect(function(hit) local playerfromhit = hit.Parent:findFirstChild("Humanoid").Parent local player = game.Players:findFirstChild(playerfromhit.Name) if player:FindFirstChild("leaderstats") then if player.leaderstats.Money.Value>=4 then player.leaderstats.Money.Value=player.leaderstats.Money.Value-5 end end end)--should work
[Qivr] Hail Greenland! |
|
|
| Report Abuse |
|
|
DavidBene
|
  |
| Joined: 26 Nov 2014 |
| Total Posts: 163 |
|
|
| 24 Dec 2014 02:41 AM |
| What was your output? Did you get an error? |
|
|
| Report Abuse |
|
|
Qivr
|
  |
| Joined: 22 Aug 2014 |
| Total Posts: 5407 |
|
|
| 24 Dec 2014 02:43 AM |
Just so you can understand, the (hit) part in (function(hit) is the body part that hits the part and i'm assuming leaderstats are in the player in the list game.Players and the (hit) comes from the player in workspace, so your script was trying to find the leaderstats in your in-game character. also in an if statement, you can't just have a "Value>4" you have to have "==" or ">=" or "<=" hopefully you understand im bad at explaining things qqq
[Qivr] Hail Greenland! |
|
|
| Report Abuse |
|
|