Yesterday i posted a question but since i didn't it to count as spam i just waited until today to ask this. Anyways after i fixed my problem yesterday i decided to get a little advanced and wanted to make it to where if Hot is on, the player has to turn if off first before turning on the cold one. So i looked up and read some stuff on the wiki and came up with this. I forgot to add that i added values to both Hot and Cold. The Name of the value of cold is ItsOn1 And the name of the value of hot is ItsOn.
Sprinkle = workspace.Shower.Shower.ParticleEmitter2 local hot = false ItsOn = workspace.Shower.Cold.ItsOn1 ItsOn2 = script.Parent.ItsOn2 if ItsOn == true then repeat wait() until ItsOn == false end function onClicked() hot = not hot --This is a trick to toggle a boolean's state between true and false. if hot == true then Sprinkle.Enabled = true print("On") elseif hot == false then Sprinkle.Enabled = false print("Off") ItsOn2 = true end end script.Parent.MouseClick:connect(onClicked)
But instead i just get this on the output. "21:40:26.236 - ItsOn2 is not a valid member of Part 21:40:26.237 - Script 'Workspace.Shower.Cold.ClickDetector.Script', Line 4 21:40:26.237 - Stack End 21:40:26.238 - ItsOn1 is not a valid member of Part 21:40:26.239 - Script 'Workspace.Shower.Hot.ClickDetector.Script', Line 3 21:40:26.239 - Stack End" Can someone help me?"
Sprinkle = workspace.Shower.Shower.ParticleEmitter2 local hot = false ItsOn = workspace.Shower.ItsOn1 -- Why isn't its on two defined this way? Also, I assume shower is a model? ItsOn2 = script.Parent.Parent.ItsOn2 -- I assume it's in a model if ItsOn == true then repeat wait() until ItsOn == false end function onClicked() hot = not hot --This is a trick to toggle a boolean's state between true and false. if hot then -- No need for if hot == true, this should work fine Sprinkle.Enabled = true print("On") elseif not hot then -- Once again, == has been depricated Sprinkle.Enabled = false print("Off") ItsOn2 = true end end script.Parent.MouseClick:connect(onClicked)