|
| 02 Apr 2014 12:09 PM |
I started learning lua but I'm not very good at it yet. I need a script that I can put into a brick so that is adds points ( to the leaderboard ) but if you've already stepped on it/touched it, it won't give you any points.
~Ipads don't have siggies~ |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 02 Apr 2014 12:11 PM |
make table debounce ontouched if debounce local alreadytouched = false for do loop on the table check if playername is equal, then set alreadytouched to true when its checked use table.insert() on the name of the player on the table. then put end's |
|
|
| Report Abuse |
|
|
|
| 02 Apr 2014 12:12 PM |
debounce .Touched event GetPlayerFromCharacter(object.Parent) or FindFirstChild(object.Parent.Name)
leaderstats
etc
|
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
|
| 02 Apr 2014 12:13 PM |
island,
but if you've already stepped on it/touched it, it won't give you any points.
Then it would be possible... |
|
|
| Report Abuse |
|
|
|
| 02 Apr 2014 12:14 PM |
Thanks, I'm very bad at this right now, so what edits do I make to that? ( other than the ends ) Or do I just put it straight in like that?
~Ipads don't have siggies~ |
|
|
| Report Abuse |
|
|
Kingmouli
|
  |
| Joined: 28 Sep 2012 |
| Total Posts: 1292 |
|
| |
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
| |
|
|
| 02 Apr 2014 12:18 PM |
game.Players.PlayerAdded:connect(function(p) AT = Instance.new("BoolValue",p) AT.Name = "alreadyTouched" end)
script.Parent.Touched:connect(function(h) --assuming u already have leaderboard.. if game.Players:findFirstChild(h.Parent.Name) then p = game.Players[h.Parent.Name] P = p.leaderstats.Points if p.alreadyTouched.Value == false then p.alreadyTouched.Value = true P.Value = P.Value+10 end end end) |
|
|
| Report Abuse |
|
|