function clickd() if script.Parent.MusicENB == true then script.Parent.MusicENB = false J_ROOM.TextColor3 = Color3.new(170,0,0) else script.Parent.MusicENB = true J_ROOM.TextColor3 = Color3.new(0,85,0) end end script.Parent.MouseEnter:connect(hover) script.Parent.MouseLeave:connect(unhover) script.Parent.MouseButton1Click:connect(clickd) J_ROOM = script.Parent MOver = script.Parent.Parent.Parent.MOver
It is not working. It says that MusicENB is not a member of TextButton when it CLEARLY is and I do not know why. MusicENB is a BOOLEAN Value but for some reason it cannot be detected by the script!? Take a look at the img: http://i.imgur.com/OILBZ66.png
That error has happened to me too sometimes when I tried to access a value. I learned that the problem was caused because I was trying to access the object itself, rather than it's property called Value
, which actually stores the information. The correct way to have read the boolean would be like so:
function clickd() if script.Parent.MusicENB.Value == true then --I added a ".Value" to the end of "MusicENB" so that the script accesses its value rather than the object itself script.Parent.MusicENB.Value = false J_ROOM.TextColor3 = Color3.new(170,0,0) else script.Parent.MusicENB.Value = true J_ROOM.TextColor3 = Color3.new(0,85,0) end end script.Parent.MouseEnter:connect(hover) script.Parent.MouseLeave:connect(unhover) script.Parent.MouseButton1Click:connect(clickd) J_ROOM = script.Parent MOver = script.Parent.Parent.Parent.MOver
Hope this helped!