Ghillie3
|
  |
| Joined: 22 Aug 2011 |
| Total Posts: 10 |
|
|
| 31 Aug 2011 11:21 PM |
I'm trying to get the script to make it's parent (the brick) unanchore everything it touches, but I don't want it to unanchor it if it's locked, because if it unanchores locked objects the baseplate will fall. So far I have changed the script atleast 10 different times and it won't work! I can't find any help about it in the wiki or anything. =[
I'm really having trouble with these on touched functions! |
|
|
| Report Abuse |
|
|
Ghillie3
|
  |
| Joined: 22 Aug 2011 |
| Total Posts: 10 |
|
|
| 31 Aug 2011 11:30 PM |
I pretty much want it to look like:
if script.Parent=unlocked
function on touched unanchor, or somthing like that? gaaah I'm so confused! :0
|
|
|
| Report Abuse |
|
|
Ghillie3
|
  |
| Joined: 22 Aug 2011 |
| Total Posts: 10 |
|
|
| 31 Aug 2011 11:47 PM |
I can't even get this to work!
function onTouched() script.Parent.BrickColor = BrickColor.Random() end |
|
|
| Report Abuse |
|
|
getkoed
|
  |
| Joined: 18 Feb 2010 |
| Total Posts: 2298 |
|
|
| 31 Aug 2011 11:53 PM |
script.Parent.Touched:connect(function() script.Parent.BrickColor = BrickColor.new(math.random) end)
I didn't test it, I think it works :3 |
|
|
| Report Abuse |
|
|
getkoed
|
  |
| Joined: 18 Feb 2010 |
| Total Posts: 2298 |
|
|
| 31 Aug 2011 11:54 PM |
Also, don't forget to TAG your functions, so don't only stop the function with end.
function onTouch() FUNCTION HERE end
script.Parent.Touched:connect(onTouch)
|
|
|
| Report Abuse |
|
|
Ghillie3
|
  |
| Joined: 22 Aug 2011 |
| Total Posts: 10 |
|
|
| 31 Aug 2011 11:57 PM |
| Thank you! I'll try it out! |
|
|
| Report Abuse |
|
|
Ghillie3
|
  |
| Joined: 22 Aug 2011 |
| Total Posts: 10 |
|
|
| 31 Aug 2011 11:58 PM |
Okay this is what i have sofar and it's not working
function onTouched(part) if part.Locked == false then part:Anchored == false() end end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2011 12:06 AM |
This is a problem I saw:
part:Anchored == false()
There are multiple things wrong with that line. First of all, it should be: part.Anchored = false
When accessing values like anchored, etc. etc. you still use a period. When SETTING values, you use 1 equal sign, not 2. And its "false", not "false()"
|
|
|
| Report Abuse |
|
|
Ghillie3
|
  |
| Joined: 22 Aug 2011 |
| Total Posts: 10 |
|
|
| 01 Sep 2011 12:12 AM |
| Oh thanks! I looked in the output and it said somthing was wrong on line 3, now I know! Thanks! |
|
|
| Report Abuse |
|
|
Ghillie3
|
  |
| Joined: 22 Aug 2011 |
| Total Posts: 10 |
|
|
| 01 Sep 2011 12:13 AM |
| Now it works perfectly! :D |
|
|
| Report Abuse |
|
|