Motioning
|
  |
| Joined: 25 Aug 2012 |
| Total Posts: 254 |
|
|
| 04 Apr 2015 11:10 AM |
At first, right when I jump into test mode, it says "Code Declined", and when I enter the correct code, it doesn't do anything.
This is supposed to award a player 50 points when they enter the correct code (found on twitter), but it doesn't. Help?
---------------------------------------------------------------------------------
local box = script.Parent.Parent.CodeBox local plr = script.Parent.Parent.Parent.Parent
if box.Text == "GimmieDaMonie" then box.Text = "Code Accepted!" wait(3) box.Text = "Redeem Code" plr.leaderstats.Points.Value = plr.leaderstats.Points.Value + 50 else box.Text = "Code Declined!" wait(3) box.Text = "Redeem Code" end |
|
|
| Report Abuse |
|
|
Motioning
|
  |
| Joined: 25 Aug 2012 |
| Total Posts: 254 |
|
| |
|
Motioning
|
  |
| Joined: 25 Aug 2012 |
| Total Posts: 254 |
|
| |
|
eLunate
|
  |
| Joined: 29 Jul 2014 |
| Total Posts: 13268 |
|
|
| 04 Apr 2015 11:26 AM |
| That checks like right away |
|
|
| Report Abuse |
|
|
jewelycat
|
  |
| Joined: 10 Sep 2008 |
| Total Posts: 17345 |
|
|
| 04 Apr 2015 11:27 AM |
Your whole script runs through and ends instantly.
You probably want this to run when a button is clicked, or the TextLabel is entered in. You need an event. |
|
|
| Report Abuse |
|
|
Tuneable
|
  |
| Joined: 16 Feb 2013 |
| Total Posts: 2932 |
|
|
| 04 Apr 2015 11:28 AM |
| Your issue is that you're checking if the user entered the code on start-up, giving them no time to put in the code. Try wrapping your code (excluding the variables) into a FocusLost event. |
|
|
| Report Abuse |
|
|
Motioning
|
  |
| Joined: 25 Aug 2012 |
| Total Posts: 254 |
|
|
| 04 Apr 2015 11:30 AM |
| I have no idea what you mean by that, |
|
|
| Report Abuse |
|
|
025110
|
  |
| Joined: 23 Nov 2012 |
| Total Posts: 57661 |
|
|
| 04 Apr 2015 11:35 AM |
| use .FocusLost and use :lower() == "gimidamonie" |
|
|
| Report Abuse |
|
|
Motioning
|
  |
| Joined: 25 Aug 2012 |
| Total Posts: 254 |
|
| |
|
|
| 04 Apr 2015 11:41 AM |
local box = script.Parent.Parent.CodeBox local plr = script.Parent.Parent.Parent.Parent
box.FocusLost:connect(function() if box.Text == "GimmieDaMonie" then box.Text = "Code Accepted!" wait(3) box.Text = "Redeem Code" plr.leaderstats.Points.Value = plr.leaderstats.Points.Value + 50 else box.Text = "Code Declined!" wait(3) box.Text = "Redeem Code" end end) |
|
|
| Report Abuse |
|
|
Motioning
|
  |
| Joined: 25 Aug 2012 |
| Total Posts: 254 |
|
|
| 04 Apr 2015 11:53 AM |
| It worked! Thanks! I also have another problem though, players that redeemed it can also redeem it again for 50 more points, how could I fix that? |
|
|
| Report Abuse |
|
|
jewelycat
|
  |
| Joined: 10 Sep 2008 |
| Total Posts: 17345 |
|
|
| 04 Apr 2015 11:55 AM |
After redeeming, save a value to the player that notes they redeemed that code
Check that value before redeeming. |
|
|
| Report Abuse |
|
|
Motioning
|
  |
| Joined: 25 Aug 2012 |
| Total Posts: 254 |
|
|
| 04 Apr 2015 11:58 AM |
| I'm not that great at scripting, and I don't know how to code that, could you give me the lines? |
|
|
| Report Abuse |
|
|