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: Help with this Script:

Previous Thread :: Next Thread 
Computermaster01 is online. Computermaster01
Joined: 29 May 2012
Total Posts: 369
20 Feb 2014 09:10 PM
I made a thread about this already, but nothing anybody showed me worked, so I made a new script, and it seems to be working except for the ChangeMode function part, so here is the script:

Button = script.Parent
Mode = script.Parent.Parent.GameMode.Value
i = "I want to"

function ChangeMode() -- This function seems to not be working, I don't know why?
if Mode == true then
Mode = false
end
if Mode == false then
Mode = true
end
end

Button.MouseButton1Down:connect(ChangeMode)

if Mode == true then
Button.Text = (i.. "Play!")
end
if Mode == false then
Button.Text = (i.. "Watch!")
end
Report Abuse
Computermaster01 is online. Computermaster01
Joined: 29 May 2012
Total Posts: 369
20 Feb 2014 09:21 PM
Bump
Report Abuse
Tehpwnzor48 is not online. Tehpwnzor48
Joined: 14 Aug 2011
Total Posts: 28
20 Feb 2014 09:21 PM
Possibly, changing from "if Mode == true then Mode = false" can affect "if Mode == false then Mode = true" Try putting and else instead of if the second time.
Report Abuse
Tehpwnzor48 is not online. Tehpwnzor48
Joined: 14 Aug 2011
Total Posts: 28
20 Feb 2014 09:22 PM
Also, the bottom part you need to put "while true do" before it and then an "end"
Report Abuse
Computermaster01 is online. Computermaster01
Joined: 29 May 2012
Total Posts: 369
20 Feb 2014 09:26 PM
^That didn't work, but thanks for trying.

Does anyone else have something that would work?
Report Abuse
Computermaster01 is online. Computermaster01
Joined: 29 May 2012
Total Posts: 369
20 Feb 2014 09:37 PM
B2
Report Abuse
V0xels is not online. V0xels
Joined: 30 Mar 2012
Total Posts: 2072
20 Feb 2014 09:39 PM
Try making the variable Mode to not have Value at the end.

that way it'd be like Mode.Value

That worked for me once, not sure if it will help you though. Give it a try.
Report Abuse
Computermaster01 is online. Computermaster01
Joined: 29 May 2012
Total Posts: 369
20 Feb 2014 10:07 PM
^Thanks but that didn't work. Does anyone else have any thing I could do? Cause I really need this to work. (B3)
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
20 Feb 2014 10:21 PM
Button = script.Parent
Mode = script.Parent.Parent.GameMode
i = "I want to "

function ChangeMode() -- This function seems to not be working, I don't know why?
if Mode.Value == true then
Mode.Value = false
end
if Mode.Value == false then
Mode.Value = true
end
end

Button.MouseButton1Down:connect(ChangeMode)

if Mode.Value == true then
Button.Text = (i.. "Play!")
else
Button.Text = (i.. "Watch!")
end

I basically got rid of the .Value in the variable Mode, then added .Value after whenever the variable is used. Whenever you use a value (number, string, bool, etc.) Don't use .Value in the variable, because it doesn't update.
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
20 Feb 2014 10:23 PM
Oh, I missed something! You are checking for the mode value before the ChangeMode fires. Try this:

Button = script.Parent
Mode = script.Parent.Parent.GameMode
i = "I want to "

Button.MouseButton1Down:connect(function()
if Mode.Value == true then
Mode.Value = false
end
if Mode.Value == false then
Mode.Value = true
end
end)


Mode:Changed:connect(function()
if Mode.Value == true then
Button.Text = (i.. "Play!")
else
Button.Text = (i.. "Watch!")
end

end)
Report Abuse
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
20 Feb 2014 10:24 PM
..Yet another typo. This is my last post, I promise!

Button = script.Parent
Mode = script.Parent.Parent.GameMode
i = "I want to "

Button.MouseButton1Down:connect(function()
if Mode.Value == true then
Mode.Value = false
end
if Mode.Value == false then
Mode.Value = true
end
end)


Mode.Changed:connect(function()
if Mode.Value == true then
Button.Text = (i.. "Play!")
else
Button.Text = (i.. "Watch!")
end

end)
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