|
| 31 Jan 2013 05:07 PM |
I'm working on a game and i'm trying to make a button that gives points when clicked. could i have some help with that? |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2013 05:09 PM |
| I don't believe ClickDetectors give exact points when clicked. |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2013 05:10 PM |
Help? The event MouseClick used with ClickDetectors returns the player. Ex:
Part.ClickDetector.MouseClick:connect(function (player) print(player.Name) end)
All you have to do is find the stats or points and just add to it.
~ṡсɾïρτïṉģ hεlρεɾṡ ۩ lυαlεαɾṉεɾṡ ④ øƒвќṃṿј~ ღ ▂▃▅▆█ρεώḋïερïε☄сυτïερïε█▆▅▃▂ღ 【▬】 |
|
|
| Report Abuse |
|
|
Saltless
|
  |
| Joined: 24 Dec 2012 |
| Total Posts: 107 |
|
|
| 31 Jan 2013 05:11 PM |
Insert it into the brick.
script.Parent.ClickDetector.MouseClick:connect(function(player) repeat wait() until player.leaderstats and player.leaderstats.YOURPOINTSNAME points = player.leaderstats.YOURPOINTSNAMES points.Value = points.Value + 5 end) |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2013 05:13 PM |
| Sorry, I misunderstood what you meant by 'points'. I thought you meant a Vector3 point, you meant a score point. |
|
|
| Report Abuse |
|
|
|
| 31 Jan 2013 05:19 PM |
| Thank you very much Saltless |
|
|
| Report Abuse |
|
|
Quenty
|
  |
| Joined: 03 Sep 2009 |
| Total Posts: 9316 |
|
|
| 31 Jan 2013 05:43 PM |
Saltless's error verification is wrong, which shouldn't matter too much. Here's my fix.
script.Parent.ClickDetector.MouseClick:connect(function(Player) if Player and Player:FindFirstChild("leaderstats") and Player.leaderstats:FindFirstChild("YOURPOINTSNAME") then Player.leaderstats.YOURPOINTSNAME.Value = Player.leaderstats.YOURPOINTSNAME.Value + 5 else print("Could not identify Player's leaderstat or point value!") end end) |
|
|
| Report Abuse |
|
|