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 » Scripting Helpers
Home Search
 

I need help with a script:

Previous Thread :: Next Thread 
Hutzaih is not online. 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 is not online. Hutzaih
Joined: 23 Oct 2013
Total Posts: 2875
11 Mar 2014 07:36 PM
bump1

stalk the stalker
Report Abuse
Hutzaih is not online. Hutzaih
Joined: 23 Oct 2013
Total Posts: 2875
11 Mar 2014 07:38 PM
bump2 :\/

stalk the stalker
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
11 Mar 2014 07:38 PM
#SoNotACopyOfCookieClicker

ROBUX isnt defined yet.
Report Abuse
Hutzaih is not online. 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
DerProgrammierer is not online. DerProgrammierer
Joined: 16 Aug 2007
Total Posts: 12992
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 is not online. 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 is not online. Hutzaih
Joined: 23 Oct 2013
Total Posts: 2875
11 Mar 2014 07:45 PM
No help. :c

stalk the stalker
Report Abuse
DerProgrammierer is not online. DerProgrammierer
Joined: 16 Aug 2007
Total Posts: 12992
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 is not online. 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
DerProgrammierer is not online. DerProgrammierer
Joined: 16 Aug 2007
Total Posts: 12992
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 is not online. 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
TheLagScript is not online. TheLagScript
Joined: 13 Apr 2012
Total Posts: 2004
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
DerProgrammierer is not online. DerProgrammierer
Joined: 16 Aug 2007
Total Posts: 12992
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 is not online. 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
DerProgrammierer is not online. DerProgrammierer
Joined: 16 Aug 2007
Total Posts: 12992
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 is not online. 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
GRAGGER2001 is not online. GRAGGER2001
Joined: 05 Apr 2009
Total Posts: 2043
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
blahblah26 is not online. blahblah26
Joined: 02 Jan 2008
Total Posts: 141
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
DerProgrammierer is not online. DerProgrammierer
Joined: 16 Aug 2007
Total Posts: 12992
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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