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 in button

Previous Thread :: Next Thread 
ExplodeLikeAVolcano is not online. ExplodeLikeAVolcano
Joined: 02 Nov 2013
Total Posts: 12146
23 Dec 2016 02:57 PM
When I click the button, it's only changing to the "VISUAL: 2" not the other numbers?

function onClicked()
script.Parent.Parent.TextButton.Text = "VISUAL: 2"
end

script.Parent.MouseButton1Click:connect(onClicked)

function onClicked()
script.Parent.Parent.TextButton.Text = "VISUAL: 3"
end

script.Parent.MouseButton1Click:connect(onClicked)

function onClicked()
script.Parent.Parent.TextButton.Text = "VISUAL: 4"
end

script.Parent.MouseButton1Click:connect(onClicked)

function onClicked()
script.Parent.Parent.TextButton.Text = "VISUAL: 5"
end

script.Parent.MouseButton1Click:connect(onClicked)

function onClicked()
script.Parent.Parent.TextButton.Text = "VISUAL: 6"
end

script.Parent.MouseButton1Click:connect(onClicked)

function onClicked()
script.Parent.Parent.TextButton.Text = "VISUAL: 7"
end

script.Parent.MouseButton1Click:connect(onClicked)


Report Abuse
OAuth2 is not online. OAuth2
Joined: 27 Nov 2016
Total Posts: 751
23 Dec 2016 02:59 PM
I died.

script.Parent.MouseButton1Click:connect(function()
script.Parent.Parent.TextButton.Text = "VISUAL: " ..tonumber(string.sub(8)) + 1
end)


~ lmfao lmfao lmfao lmfao lmfao lmfao lmfao lmfao lmfao lmfao lmfao lmfao lmfao lmfao lmfao ~
Report Abuse
ExplodeLikeAVolcano is not online. ExplodeLikeAVolcano
Joined: 02 Nov 2013
Total Posts: 12146
23 Dec 2016 03:00 PM
Thanks, my apologies, I'm horrible at scripting.


Report Abuse
ExplodeLikeAVolcano is not online. ExplodeLikeAVolcano
Joined: 02 Nov 2013
Total Posts: 12146
23 Dec 2016 03:02 PM
Now, it's not working at all.


Report Abuse
ExplodeLikeAVolcano is not online. ExplodeLikeAVolcano
Joined: 02 Nov 2013
Total Posts: 12146
23 Dec 2016 03:08 PM
bump


Report Abuse
ExplodeLikeAVolcano is not online. ExplodeLikeAVolcano
Joined: 02 Nov 2013
Total Posts: 12146
23 Dec 2016 03:50 PM
:(


Report Abuse
theEvilMaster4444 is not online. theEvilMaster4444
Joined: 12 Apr 2011
Total Posts: 1469
23 Dec 2016 03:50 PM
what is this supposed to do??


Siggynature
Report Abuse
theEvilMaster4444 is not online. theEvilMaster4444
Joined: 12 Apr 2011
Total Posts: 1469
23 Dec 2016 03:59 PM
theres a substitute way which might take longer,

have 8 buttons each called visual1,visual2,etc

make all them invisible except visual 1 and make a script whenever u click visual 1 it makes it invis and shows visual 2 and so on and so forth


Siggynature
Report Abuse
ExplodeLikeAVolcano is not online. ExplodeLikeAVolcano
Joined: 02 Nov 2013
Total Posts: 12146
23 Dec 2016 04:08 PM
that takes too long, it'd be easier if it were one button +1 each time someone clicks it


Report Abuse
Revorious is not online. Revorious
Joined: 04 Feb 2012
Total Posts: 477
23 Dec 2016 04:18 PM
local Vis = 1
local MaxVis = 8

function onClicked()
script.Parent.Parent.TextButton.Text = "VISUAL: "..Vis
if Vis == MaxVis then
Vis = 1
else
Vis = Vis +1
end
end

script.Parent.MouseButton1Click:connect(onClicked)


local Globe = workspace; repeat wait(1) print('Hello World!') until Globe == nil
Report Abuse
ExplodeLikeAVolcano is not online. ExplodeLikeAVolcano
Joined: 02 Nov 2013
Total Posts: 12146
23 Dec 2016 04:20 PM
Script also doesn't work ^


Report Abuse
ExplodeLikeAVolcano is not online. ExplodeLikeAVolcano
Joined: 02 Nov 2013
Total Posts: 12146
23 Dec 2016 04:20 PM
My bad, yes, it does.

Thanks, mate.


Report Abuse
ExplodeLikeAVolcano is not online. ExplodeLikeAVolcano
Joined: 02 Nov 2013
Total Posts: 12146
23 Dec 2016 04:22 PM
How would I make it minus when I right click?

Left click adds the number up, how would I make it so when you right click the number goes down?

Isn't that function broken?

MouseButton2Down?


Report Abuse
ExplodeLikeAVolcano is not online. ExplodeLikeAVolcano
Joined: 02 Nov 2013
Total Posts: 12146
23 Dec 2016 04:23 PM
This is what I have now, but when I do right click, it leaves me off at another random number.

local Vis = 1
local MaxVis = 30

function onClicked()
script.Parent.Parent.Visual1.Text = "VISUAL: "..Vis
if Vis == MaxVis then
Vis = 1
else
Vis = Vis +1
end
end

script.Parent.MouseButton1Click:connect(onClicked)

local Vis = 1
local MaxVis = 30

function onClicked()
script.Parent.Parent.Visual1.Text = "VISUAL: "..Vis
if Vis == MaxVis then
Vis = 1
else
Vis = Vis -1
end
end

script.Parent.MouseButton2Down:connect(onClicked)


Report Abuse
icelys is not online. icelys
Joined: 13 Mar 2016
Total Posts: 49
23 Dec 2016 04:38 PM
You keep on naming your functions "onClicked". However, you already declared this function earlier. Try giving each function that you connect a different name, as they both have different bodies.
Report Abuse
ExplodeLikeAVolcano is not online. ExplodeLikeAVolcano
Joined: 02 Nov 2013
Total Posts: 12146
23 Dec 2016 05:34 PM
Thanks, that did the trick


Report Abuse
ExplodeLikeAVolcano is not online. ExplodeLikeAVolcano
Joined: 02 Nov 2013
Total Posts: 12146
23 Dec 2016 05:36 PM
How would I make the MaxVis = 0 when I minus? It just keeps going down infinite. I want it to stop at 0 (when right click, it minuses 1)

local Vis = 1
local MaxVis = 30

function whenclicked()
script.Parent.Parent.Visual1.Text = "VISUAL: "..Vis
if Vis == MaxVis then
Vis = 1
else
Vis = Vis -1
end
end

script.Parent.MouseButton2Down:connect(whenclicked


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