of     1   

ChadTheCreator
#44939463Friday, April 01, 2011 10:12 PM GMT

I'm trying to make a button magnet that will attach a magnet when the button is clicked, and dettach it when it's clicked again. If you can figure out how to form it into an on/off button model rather than a all-purpose-button model, that'd work as well. ~~Button script: local CD = script.Parent.ClickDetector local Crane = script.Parent.Parent.Parent function doit() Crane.Magnet.turnOff.Value = true end CD.MouseClick:connect(doit) ~~Magnet script: local Base = script.Parent local Stuck = false local turnOff = Base.turnOff deBounce = false while true do if turnOff.Value = false then script.Parent.BodyPosition.position = script.Parent.Parent.mag2.Position local Stuck = true turnOff.Changed:connect(unStick) wait(.1) local Stuck = false end ~~The magnet IS named "Magnet" and there is a BodyPositioninside it as well as a turnOff value.
SilverRaptor
#44939684Friday, April 01, 2011 10:16 PM GMT

So what do you want us to do?
KittyMcNewt
#44939808Friday, April 01, 2011 10:17 PM GMT

"How to form it into an on/off switch."
ChadTheCreator
#44939922Friday, April 01, 2011 10:19 PM GMT

It doesn't work right now. I'd prefer 1 button that turns it on and off with clicks but a 2-button system will work as well.
SilverRaptor
#44940036Friday, April 01, 2011 10:21 PM GMT

local CD = script.Parent.ClickDetector local Crane = script.Parent.Parent.Parent function doit() Crane.Magnet.turnOff.Value = true end CD.MouseClick:connect(doit) local Base = script.Parent local Stuck = false local turnOff = Base.turnOff deBounce = false while wait() do if turnOff.Value == false then script.Parent.BodyPosition.position = script.Parent.Parent.mag2.Position local Stuck = true turnOff.Changed:connect(unStick) wait(.1) local Stuck = false end I fixed a couple things for you, but are you sure you can stick a connection line in the middle of the second part?
ChadTheCreator
#44940294Friday, April 01, 2011 10:25 PM GMT

The 2 scripts are in seperate bricks, on the same model.

    of     1