|
| 01 Mar 2015 03:17 PM |
local Button = script.Parent local Player = game.Players.LocalPlayer local PlayerGui = Player:WaitForChild("PlayerGui") --Referencing before loading protection. local Cash = PlayerGui:WaitForChild("cash") --Referencing before loading protection. local Income = PlayerGui:WaitForChild("income") --Referencing before loading protection.
local PointsService = game:GetService("PointsService") script.Parent.MouseButton1Down:connect(function() if Cash.Value >= 1000 then PointsService:AwardPoints(script.Parent.Parent.Parent.Parent.Parent.userId, 1000) Cash.Value = Cash.Value - 1000 Income.Value = Income.Value + 30 end end)
No errors, but am I missing something? |
|
|
| Report Abuse |
|
|
| |
|
|
| 01 Mar 2015 03:18 PM |
| You bumped after 1 minute? abandon thread |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2015 03:20 PM |
| Had 2 views and was going down the list.. |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2015 03:23 PM |
| What is your issue? You've posted the code, but haven't explained what your problem is in full. |
|
|
| Report Abuse |
|
|
|
| 01 Mar 2015 03:27 PM |
Doesn't work...
No problem in output just simply doesn't work. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
|
| 03 Mar 2015 06:20 PM |
Did you name it cash not Cash? It is CaSe SeNsItIvE
I wanna be a future game dev :3 |
|
|
| Report Abuse |
|
|
|
| 03 Mar 2015 06:21 PM |
I mean "Did you name it 'Cash' not 'cash'?
I wanna be a future game dev :3 |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2015 08:47 PM |
| Cash = cash and it is named cash the value. |
|
|
| Report Abuse |
|
|
hkep
|
  |
| Joined: 19 Jul 2014 |
| Total Posts: 550 |
|
|
| 04 Mar 2015 09:45 PM |
local Button = script.Parent local Player = game.Players.LocalPlayer repeat wait()until Player.PlayerGui local PlayerGui=Player.PlayerGui repeat wait()until PlayerGui.cash local Cash=PlayerGui.cash --Referencing before loading protection. repeat wait()until PlayerGui.income local Income=PlayerGui.income --Referencing before loading protection.
local PointsService = game:GetService("PointsService") script.Parent.MouseButton1Down:connect(function() if(Cash.Value>=1000)then --may be read as if Cash.Value then PointsService:AwardPoints(script.Parent.Parent.Parent.Parent.Parent.userId, 1000) Cash.Value =(Cash.Value-1000) Income.Value =(Income.Value+30) end end) -- if your paths are correct, this corrects most read errors thanks to parentheses -- there is a function, PointsService:GetAwardablePoints(), which returns the amount of points that is possible to be awarded to a player. -- that might be your problem |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
|
| 06 Mar 2015 06:16 PM |
Oh hey it's killer, long time no see.
A suggestion for future problems, display notifiers in the script. An example would be print "1" after a certain event passed.
Also is this in a local script? |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2015 06:46 PM |
Yes it is a local script and, thanks for the tip.
Also
Hey, I remember you from laser tag :) |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2015 06:57 PM |
| It stops working after mousedownbutton |
|
|
| Report Abuse |
|
|
| |
|
Dpick418
|
  |
| Joined: 25 Apr 2014 |
| Total Posts: 2 |
|
|
| 06 Mar 2015 07:12 PM |
| I don't understand, I don't script but I am fairly decent with Java. From my understanding the code you are showing is initializing variables. Perhaps Lua uses naming conventions on your variables. I make plenty of mistakes when coding like silly ones, perhaps you have too many 'parent.' in the point service line? I don't know hopefully, my info gave you some kind of help or idea to what is wrong. |
|
|
| Report Abuse |
|
|
Dpick418
|
  |
| Joined: 25 Apr 2014 |
| Total Posts: 2 |
|
|
| 06 Mar 2015 07:15 PM |
| Wait I think I might of found the issue. Perhaps you forgot to add a ) to the end of script.Parent.MouseButton1Down:connect(Function()). You have script.Parent.MouseButton1Down:connect(Function() |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2015 07:16 PM |
copy and paste what this prints.
local Button = script.Parent local Player = game.Players.LocalPlayer print("Waiting for children...") local PlayerGui = Player:WaitForChild("PlayerGui") --Referencing before loading protection. print("Player gui loaded!") local Cash = PlayerGui:WaitForChild("cash") --Referencing before loading protection. print("Cash loaded!") local Income = PlayerGui:WaitForChild("income") --Referencing before loading protection. print("Loaded Income!")
local PointsService = game:GetService("PointsService") script.Parent.MouseButton1Down:connect(function() print("Pressed") if Cash.Value >= 1000 then print("Enough cash!") PointsService:AwardPoints(script.Parent.Parent.Parent.Parent.Parent.userId, 1000) Cash.Value = Cash.Value - 1000 Income.Value = Income.Value + 30 print("Awarded!") end end) |
|
|
| Report Abuse |
|
|
|
| 06 Mar 2015 07:18 PM |
| It goes up to loaded income but not pressed |
|
|
| Report Abuse |
|
|
| |
|
|
| 06 Mar 2015 07:26 PM |
| Whats the parent of this script? What type of script is this? |
|
|
| Report Abuse |
|
|