generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Script, Doesn't Work.

Previous Thread :: Next Thread 
killer4723 is not online. killer4723
Joined: 05 Aug 2009
Total Posts: 12483
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
killer4723 is not online. killer4723
Joined: 05 Aug 2009
Total Posts: 12483
01 Mar 2015 03:18 PM
b1
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
01 Mar 2015 03:18 PM
You bumped after 1 minute? abandon thread
Report Abuse
killer4723 is not online. killer4723
Joined: 05 Aug 2009
Total Posts: 12483
01 Mar 2015 03:20 PM
Had 2 views and was going down the list..
Report Abuse
dinamite4362 is not online. dinamite4362
Joined: 15 Sep 2009
Total Posts: 57
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
killer4723 is not online. killer4723
Joined: 05 Aug 2009
Total Posts: 12483
01 Mar 2015 03:27 PM
Doesn't work...

No problem in output just simply doesn't work.
Report Abuse
killer4723 is not online. killer4723
Joined: 05 Aug 2009
Total Posts: 12483
01 Mar 2015 03:50 PM
2
Report Abuse
killer4723 is not online. killer4723
Joined: 05 Aug 2009
Total Posts: 12483
03 Mar 2015 06:00 PM
3
Report Abuse
DevCreptic is not online. DevCreptic
Joined: 29 Dec 2014
Total Posts: 4
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
DevCreptic is not online. DevCreptic
Joined: 29 Dec 2014
Total Posts: 4
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
killer4723 is not online. killer4723
Joined: 05 Aug 2009
Total Posts: 12483
04 Mar 2015 08:47 PM
Cash = cash and it is named cash the value.
Report Abuse
hkep is not online. 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
killer4723 is not online. killer4723
Joined: 05 Aug 2009
Total Posts: 12483
06 Mar 2015 02:34 PM
didn't work
Report Abuse
killer4723 is not online. killer4723
Joined: 05 Aug 2009
Total Posts: 12483
06 Mar 2015 03:05 PM
\\\
Report Abuse
killer4723 is not online. killer4723
Joined: 05 Aug 2009
Total Posts: 12483
06 Mar 2015 06:11 PM
111111111
Report Abuse
GeoVolcano is not online. GeoVolcano
Joined: 05 Jul 2012
Total Posts: 1433
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
killer4723 is not online. killer4723
Joined: 05 Aug 2009
Total Posts: 12483
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
killer4723 is not online. killer4723
Joined: 05 Aug 2009
Total Posts: 12483
06 Mar 2015 06:57 PM
It stops working after mousedownbutton
Report Abuse
killer4723 is not online. killer4723
Joined: 05 Aug 2009
Total Posts: 12483
06 Mar 2015 07:11 PM
:?
Report Abuse
Dpick418 is not online. 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 is not online. 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
XtremeTemper is not online. XtremeTemper
Joined: 02 Mar 2012
Total Posts: 1774
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
killer4723 is not online. killer4723
Joined: 05 Aug 2009
Total Posts: 12483
06 Mar 2015 07:18 PM
It goes up to loaded income but not pressed
Report Abuse
killer4723 is not online. killer4723
Joined: 05 Aug 2009
Total Posts: 12483
06 Mar 2015 07:22 PM
:/
Report Abuse
XtremeTemper is not online. XtremeTemper
Joined: 02 Mar 2012
Total Posts: 1774
06 Mar 2015 07:26 PM
Whats the parent of this script? What type of script is this?
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image