Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My "if then statement" doesnt work?

Asked by 9 years ago

bin = script.Parent
function anchor(object)
object.Anchored = true end
function onTouched(part) anchor(part) end
bin.Touched:connect(onTouched)

is this right? Also i'm try to make a brick unanchor when touched.

1 answer

Log in to vote
0
Answered by
dyler3 1510 Moderation Voter
9 years ago

It's correct, but make the bricks "Anchored" property set to false. Like this:

bin = script.Parent

function anchor(object)
object.Anchored = false --"Un-Anchors" the object
end

function onTouched(part) 
anchor(part) 
end

bin.Touched:connect(onTouched)
Ad

Answer this question