Hutzaih
|
  |
| Joined: 23 Oct 2013 |
| Total Posts: 2875 |
|
|
| 11 Mar 2014 07:35 PM |
I'm trying to make a game where you click a button and it changes a hint to display the amount of times that button was clicked.
Here's the script: while true do wait(0.5) local h = Instance.new("Hint", game.Workspace) h.Text = "Number of ROBUX made:" .. (ROBUX) end
Here's the other script to connect it: ROBUX = 0 function onClicked(playerWhoClicked) wait(0.1) print(ROBUX) print 'A robux has been made!' ROBUX = ROBUX + 1 end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
The first script errors, and I don't know the problem. Help?
stalk the stalker |
|
|
| Report Abuse |
|
|
Hutzaih
|
  |
| Joined: 23 Oct 2013 |
| Total Posts: 2875 |
|
| |
|
Hutzaih
|
  |
| Joined: 23 Oct 2013 |
| Total Posts: 2875 |
|
|
| 11 Mar 2014 07:38 PM |
bump2 :\/
stalk the stalker |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 11 Mar 2014 07:38 PM |
#SoNotACopyOfCookieClicker
ROBUX isnt defined yet. |
|
|
| Report Abuse |
|
|
Hutzaih
|
  |
| Joined: 23 Oct 2013 |
| Total Posts: 2875 |
|
|
| 11 Mar 2014 07:39 PM |
@wazap
I'm not copying Cookie Clicker. -.-
It's not a game like THAT.
stalk the stalker |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2014 07:41 PM |
This is very inefficient and ROBUX isn't within the first script's scope.
Want to learn Java? Contact me or visit http://www.roblox.com/Groups/group.aspx?gid=632774 |
|
|
| Report Abuse |
|
|
Hutzaih
|
  |
| Joined: 23 Oct 2013 |
| Total Posts: 2875 |
|
|
| 11 Mar 2014 07:42 PM |
@der
Geez. Sorry. I'm new to scripting.
stalk the stalker |
|
|
| Report Abuse |
|
|
Hutzaih
|
  |
| Joined: 23 Oct 2013 |
| Total Posts: 2875 |
|
|
| 11 Mar 2014 07:45 PM |
No help. :c
stalk the stalker |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2014 07:46 PM |
After every wait, you're putting a new hint in the game. and as far as I can tell, you're not removing it. Everytime you call Instance.new, you're adding another object to the memory.
Want to learn Java? Contact me or visit http://www.roblox.com/Groups/group.aspx?gid=632774 |
|
|
| Report Abuse |
|
|
Hutzaih
|
  |
| Joined: 23 Oct 2013 |
| Total Posts: 2875 |
|
|
| 11 Mar 2014 07:52 PM |
That's the purpose. That's not what's wrong with it. If I remove it, it flashes constantly, which is what I DON'T want.
stalk the stalker |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2014 07:56 PM |
Your game is going to lag, you need to remove the last one. What you want is double buffering, which when you "draw" one thing and then another and cycle, you still need to remove the last one, because you're hogging the memory.
We also already told you what was wrong in the first script.
Want to learn Java? Contact me or visit http://www.roblox.com/Groups/group.aspx?gid=632774 |
|
|
| Report Abuse |
|
|
Hutzaih
|
  |
| Joined: 23 Oct 2013 |
| Total Posts: 2875 |
|
|
| 11 Mar 2014 07:58 PM |
You aren't any help, because you are giving me useless tips. I never wanted to reduce lag, because I want to try something new. Please actualyy fix the script.
stalk the stalker |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2014 08:00 PM |
local h = Instance.new("Hint", game.Workspace)
local robux = 1 while true do wait() h.Text = "Number of ROBUX made: " .. robux
end
function onClicked(playerWhoClicked) wait() print (robux) print 'A robux has been made!' robux = robux + 1 end
script.Parent.ClickDetector.MouseClick:connect(onClicked)
|
|
|
| Report Abuse |
|
|
|
| 11 Mar 2014 08:17 PM |
We already told you. The first script doesn't have access to ROBUX, you either need to combine the scripts above or using global variables. If you're too much of an idiot to comprehend that, then you need to go back to learning about declaring variables.
Want to learn Java? Contact me or visit http://www.roblox.com/Groups/group.aspx?gid=632774 |
|
|
| Report Abuse |
|
|
Hutzaih
|
  |
| Joined: 23 Oct 2013 |
| Total Posts: 2875 |
|
|
| 11 Mar 2014 08:21 PM |
@the Thank you very much.
@der I got a solution. I don't need help.
stalk the stalker |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2014 08:49 PM |
If you're not going to take advice from a person who has way more knowledge of programming and has been for several years, then you're not going to get very far scripting. You obviously don't know how to script, or you're too incompetent to read. I wasn't hinting when I told you what was wrong with it, you simply ignored what I said.
If you're going to be a jerk, then you shouldn't be asking for help.
Want to learn Java? Contact me or visit http://www.roblox.com/Groups/group.aspx?gid=632774 |
|
|
| Report Abuse |
|
|
Hutzaih
|
  |
| Joined: 23 Oct 2013 |
| Total Posts: 2875 |
|
|
| 11 Mar 2014 09:49 PM |
Doesn't mean I have to listen to you, der. I can learn it myself. If you are saying that I'm too stupid to learn scripting, you are the stupid one.
stalk the stalker |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2014 09:58 PM |
I'm thinking this error has been solved but here anyways:
ROBUX = 0
local h = Instance.new("Hint", game.Workspace) h.Text = "Number of ROBUX made:" .. (ROBUX)
function onClicked(playerWhoClicked) wait(0.1) print(ROBUX) print 'A robux has been made!' ROBUX = ROBUX + 1 h.Text = "Number of ROBUX made:" .. (ROBUX) end
script.Parent.ClickDetector.MouseClick:connect(onClicked) |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2014 10:03 PM |
local h = Instance.new("Hint", workspace) local robux = 0
function onClick() robux = robux + 1 print("A Robux has been made!") print(robux) h.Text = "Number of ROBUX made: " .. robux end
script.Parent.ClickDetector.MouseClick:connect(onClick) |
|
|
| Report Abuse |
|
|
|
| 11 Mar 2014 10:39 PM |
"Doesn't mean I have to listen to you, der. I can learn it myself. If you are saying that I'm too stupid to learn scripting, you are the stupid one."
You're right, you don't have to listen to me, but when people give you the solution, such as:
"ROBUX isnt defined yet." (wazap)
"and ROBUX isn't within the first script's scope."
or
"The first script doesn't have access to ROBUX, you either need to combine the scripts above or using global variables." (both by me)
If you can't figure it out based on what we told you, then you're not a scripter, because a scripter would know what we were talking about and would have been able to fix it.
No, I'm not saying you're too stupid to script. I'm telling you that you're stupid, because you obviously can't read. Your error was that ROBUX wasn't in scope, or defined in the script. WHICH MEANS YOU ARE ACCESSING A VARIABLE THAT DOESN'T EXIST.
Because you couldn't figure that out after we told you, you must be a tard, or have no idea about variables and scope, which means you need to go look at the wiki and figure it out.
The whole removing the last hint was an efficiency tip, after x amount of calls you're going to clutter the memory and lag everyone out.
Want to learn Java? Contact me or visit http://www.roblox.com/Groups/group.aspx?gid=632774 |
|
|
| Report Abuse |
|
|