|
| 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 |
|
|
| |
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 20 Feb 2014 09:26 PM |
^That didn't work, but thanks for trying.
Does anyone else have something that would work? |
|
|
| Report Abuse |
|
|
| |
|
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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|