Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 13 Sep 2011 01:25 PM |
Hello, I just need to check if this is right :D
Part = game.Workspace.Part.Value local clicks=0 local needed=5 local gui=script.Parent -- or whatever your gui is
gui.MouseButton1Click:connect(function() if clicks==needed-1 then gui.Parent=nil else click=clicks+1 Part= +2--Adds the number value up end end)
When I clicked the button it supposed to add the number value of the part :D And if you click it 5 times, it will disappear :D Is this script right? |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 13 Sep 2011 01:30 PM |
| I think so, although i'm not sure. |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2011 02:10 PM |
Part=workspace.Part.Value clicks=0 needed=5 gui=script.Parent gui.MouseButton1Click:connect(function() if clicks == needed -1 then gui:Remove() else click=clicks+1 Part = +2 end end)
Its fine, but this is shorter.
|
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 13 Sep 2011 03:16 PM |
Part=workspace.Part.Value clicks=0 needed=5 gui=script.Parent gui.MouseButton1Click:connect(function() if clicks == needed -1 then gui.Visible = false --How about that? else click=clicks+1 Part = +2 end end)
The parent is a text button? |
|
|
| Report Abuse |
|
|
|
| 13 Sep 2011 03:18 PM |
Both of you missed this: part = +2, it's Part + 2 And you said click=clicks+1, Click is not defined. I changed it also.
Part=workspace.Part.Value clicks=0 needed=5 gui=script.Parent gui.MouseButton1Click:connect(function() if clicks == needed -1 then gui.Visible = false --How about that? else clicks=clicks+1 Part + 2 end end) |
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 13 Sep 2011 03:26 PM |
@Builder
I type "Click" accidentally. I just missed a "s". Sorry D: |
|
|
| Report Abuse |
|
|
Apocalyps
|
  |
| Joined: 15 Feb 2009 |
| Total Posts: 816 |
|
|
| 13 Sep 2011 03:34 PM |
Part = workspace.Part clicks = 0 needed = 5 gui = script.Parent gui.MouseButton1Click:connect(function() if clicks == needed -1 then gui.Visible = false else clicks = clicks+1 Part.Value = Part.Value + 2 end end) |
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 13 Sep 2011 03:35 PM |
| ^ OMG ITS APOCALYPS!!!!!!!!!!!!! |
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 13 Sep 2011 03:36 PM |
@apocalyps
What's the difference? |
|
|
| Report Abuse |
|
|
Apocalyps
|
  |
| Joined: 15 Feb 2009 |
| Total Posts: 816 |
|
|
| 13 Sep 2011 03:38 PM |
this doesnt work:
something = game.Workspace.Something.Value
something + 2
^ that wont add 2 to the value... it will just give an error
even
something = something + 2
will not work cause now it initialises 'something' as a variable and so it wont increase the Value
the only way to do this is like this:
something = game.Workspace.Something something.Value = something.Value + 2 |
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 13 Sep 2011 03:41 PM |
Oh ok! How do you check if the player has the right money to buy it? Just give me few codes..I need to learn it.. |
|
|
| Report Abuse |
|
|
Apocalyps
|
  |
| Joined: 15 Feb 2009 |
| Total Posts: 816 |
|
|
| 13 Sep 2011 03:44 PM |
If the player has a NumberValue called 'Money' inside its Player object, then do this:
if THE_PLAYER.Money.Value >= AMMOUNT_OF_MONEY_NEEDED then --stuffz end |
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 13 Sep 2011 03:51 PM |
Part = workspace.Part clicks = 0 needed = 5 gui = script.Parent gui.MouseButton1Click:connect(function() if Player.Money.Value >= 50 then game.Lighting.Tools.Sword:Clone.Parent = I FORGOT THE PART WHEN YOU GIVE IT TO THE PLAYER D: end if clicks == needed -1 end gui.Visible = false
else clicks = clicks+1 Part.Value = Part.Value + 2 end end)
-_-?
|
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 13 Sep 2011 03:55 PM |
| Hey apocalyps, aren't you helping? |
|
|
| Report Abuse |
|
|
Apocalyps
|
  |
| Joined: 15 Feb 2009 |
| Total Posts: 816 |
|
|
| 13 Sep 2011 03:55 PM |
| game.Lighting.Tools.Sword:Clone().Parent = Player.Backpack |
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 13 Sep 2011 04:00 PM |
| so when I add that, will it work? |
|
|
| Report Abuse |
|
|
Apocalyps
|
  |
| Joined: 15 Feb 2009 |
| Total Posts: 816 |
|
| |
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 13 Sep 2011 04:03 PM |
Part = workspace.Part clicks = 0 needed = 5 gui = script.Parent gui.MouseButton1Click:connect(function() if Player.Money.Value >=50 then game.Lighting.Tools.Sword:Clone().Parent = Player.Backpack end if clicks == needed -1 end gui.Visible = false else clicks = clicks+1 Part.Value = Part.Value + 2 end end) |
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 13 Sep 2011 04:08 PM |
The script: 1. When click 1 time. it will take away the money and ifthe player got the right amount of money, the tool will be given.. 2. When click 2 time. it will take away the money and ifthe player got the right amount of money, the tool will be given..This will continue and continue unitl click 5 times :D
Thats the script :D is it?
|
|
|
| Report Abuse |
|
|
Apocalyps
|
  |
| Joined: 15 Feb 2009 |
| Total Posts: 816 |
|
|
| 13 Sep 2011 04:12 PM |
| If you want the player to pay for the tool then dont forget to substract the needed ammount of money from the Money value |
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 13 Sep 2011 04:12 PM |
| oh cmon I forgot..Thx for the advice! I'll try to figure it out :D |
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
|
| 13 Sep 2011 04:15 PM |
Part = workspace.Part clicks = 0 needed = 5 gui = script.Parent gui.MouseButton1Click:connect(function() if Player.Money.Value >=50 then Player.Money.Value = -50 --that is just a big guess, I know how to do it but I forgot it D: again.. game.Lighting.Tools.Sword:Clone().Parent = Player.Backpack end if clicks == needed -1 end gui.Visible = false else clicks = clicks+1 Part.Value = Part.Value + 2 end end)
Can you fix it apocalyps if there are any errors? |
|
|
| Report Abuse |
|
|
Apocalyps
|
  |
| Joined: 15 Feb 2009 |
| Total Posts: 816 |
|
|
| 13 Sep 2011 04:16 PM |
| Its the same principle with the Part.Value thingy... only now intead of adding 2, you substract 50 |
|
|
| Report Abuse |
|
|
Miro034
|
  |
| Joined: 07 Oct 2009 |
| Total Posts: 6568 |
|
| |
|
Apocalyps
|
  |
| Joined: 15 Feb 2009 |
| Total Posts: 816 |
|
|
| 13 Sep 2011 04:22 PM |
-_-'
see this part: (its from your script!)
Part.Value = Part.Value + 2
thats almost the same thing you need to do for substracting 50!
only now change 'Part' to 'Player.Money' and '+ 2' to '- 50' and then you have the piece of code you need... |
|
|
| Report Abuse |
|
|