How would i fix it these are the scripts for enable and disable i tried it with value = true and value=true
(enable ---Model By: Midnight Productions
location = script.Parent.Parent.Parent regen = script.Parent.Parent save = regen:clone() script.Parent.ClickDetector.MouseClick:connect(onClicked) function onClicked() script.Parent.Parent.IsOutOfOrder.Value=false end )
( Disable ---Model By: Midnight Productions
location = script.Parent.Parent.Parent regen = script.Parent.Parent save = regen:clone() script.Parent.ClickDetector.MouseClick:connect(onClicked) function onClicked() script.Parent.Parent.IsOutOfOrder.Value=true end )
Hello, cbeebiespoo!
Edit:
Apparently you are using each code on one part, so you dont want the click to toggle the value.
You just need to move the :Connect
to under the function
Disable:
location = script.Parent.Parent.Parent regen = script.Parent.Parent save = regen:clone() function onClicked() script.Parent.Parent.IsOutOfOrder.Value= true end ) script.Parent.ClickDetector.MouseClick:Connect(onClicked)
Enable:
location = script.Parent.Parent.Parent regen = script.Parent.Parent save = regen:clone() function onClicked() script.Parent.Parent.IsOutOfOrder.Value= false end ) script.Parent.ClickDetector.MouseClick:Connect(onClicked)
Old answer:
I found 3 problems in your code:
You are calling the :Connect
before defining the function, this can be easily fixed by moving the :Connect line to under the function definition
This doesn't really breaks your code, but may in the future. The :connect
has been deprecated, it is recommended to use :Connect
for new code.
The 2 scripts are reverting each other actions. You should use just one script to change the value, like so:
location = script.Parent.Parent.Parent regen = script.Parent.Parent save = regen:clone() function onClicked() script.Parent.Parent.IsOutOfOrder.Value= not script.Parent.Parent.IsOutOfOrder.Value --This inverts the value from the BoolValue end ) script.Parent.ClickDetector.MouseClick:Connect(onClicked)
If this solves your ploblem, please mark this answer as the "Accepted Answer"