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
 

Re: Got another noobish GUI question for you again

Previous Thread :: Next Thread 
DevRoboticTerrorist is not online. DevRoboticTerrorist
Joined: 03 Oct 2012
Total Posts: 3464
28 Sep 2014 08:13 AM
How could I make it so this script doesn't have limited clicks? I mean you click it once and it plays the song. You click it twice it stops the song. And it NEVER stops. You can do it as many times are you want.

local Dubstep1 = script.Parent

clicks = 0
function click()
clicks = clicks +1 -- adds 1 to clicks

if clicks >=1 then
game.Workspace.Music.Dubstep1:Play()
end

if clicks >= 2 then -- checks if his clicks is = or greater than 2
game.Workspace.Music.Dubstep1:Pause()
end

if clicks >= 3 then -- checks if his clicks is = or greater than 2
game.Workspace.Music.Dubstep1:Play()
end

end
Dubstep1.MouseButton1Down:connect(click)

~~RoboticTerrorist~~
Report Abuse
NoobsAreTheWorld is not online. NoobsAreTheWorld
Joined: 04 Nov 2013
Total Posts: 2044
28 Sep 2014 08:27 AM
First off this is a free model, second do it your self.

Yo mama so fat she sat on an iPhone and turned it into an iPad
Report Abuse
DevRoboticTerrorist is not online. DevRoboticTerrorist
Joined: 03 Oct 2012
Total Posts: 3464
28 Sep 2014 08:35 AM
@Above

First of all, sure all these people use free models:
http://www.roblox.com/Forum/ShowPost.aspx?PostID=146921850

Second of all, why are you even here if you want me to do it myself? Obviously I can't do it myself or I wouldn't be asking.

~~RoboticTerrorist~~
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
28 Sep 2014 08:45 AM
local Dubstep1 = script.Parent

Dubstep1.MouseButton1Down:connect(function()

clicks = clicks +1 -- adds 1 to clicks

if clicks % 2 == 0 then
game.Workspace.Music.Dubstep1:Pause()
else
game.Workspace.Music.Dubstep1:Play()
end
end)

How that works is when someone clicks dubstep1 it adds to clicks value and if the remainder of clicks/2 is 0 (it's divisible by 2) then pause it but if it's not divisible by 2 (it's an odd number) play it.
Report Abuse
DevRoboticTerrorist is not online. DevRoboticTerrorist
Joined: 03 Oct 2012
Total Posts: 3464
28 Sep 2014 08:50 AM
@kodran

09:49:33.378 - Disconnected event because of exception

~~RoboticTerrorist~~
Report Abuse
DevRoboticTerrorist is not online. DevRoboticTerrorist
Joined: 03 Oct 2012
Total Posts: 3464
28 Sep 2014 08:50 AM
@kodran

Wrong one. Sorry.

09:49:33.371 - Players.Player1.PlayerGui.ScreenGui.Top.Dubstep1.Twice:5: attempt to perform arithmetic on global 'clicks' (a nil value)

~~RoboticTerrorist~~
Report Abuse
Kodran is not online. Kodran
Joined: 15 Aug 2013
Total Posts: 5330
28 Sep 2014 08:51 AM
ahh, under the Dubstep1 = script.Parent line put clicks = 0
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