Ghillie3
|
  |
| Joined: 22 Aug 2011 |
| Total Posts: 10 |
|
|
| 31 Aug 2011 11:54 PM |
Okay, by the looks of this you'll probably know what I'm trying to do. now how do I make it work?
function onTouched(part) if part.Locked == false then part:Anchored = false() end end
script.Parent.Touched:connect(onTouched)
Thanks a bunch! |
|
|
| Report Abuse |
|
|
getkoed
|
  |
| Joined: 18 Feb 2010 |
| Total Posts: 2298 |
|
|
| 31 Aug 2011 11:56 PM |
If you want the brick unanchored if it's not locked:
script.Parent.Touched:connect(function() if (script.Parent.Locked ~= false) then script.Parent.Anchored = false end)
-- OR --
function onTouched() if (script.Parent.Locked ~= false) then script.Parent.Anchored = false end
script.Parent.Touched:connect(onTouched)
----
The two scripts are the same, but I use the first one, it's shorther than the 2nd... :3 |
|
|
| Report Abuse |
|
|
Ghillie3
|
  |
| Joined: 22 Aug 2011 |
| Total Posts: 10 |
|
| |
|
Ghillie3
|
  |
| Joined: 22 Aug 2011 |
| Total Posts: 10 |
|
|
| 01 Sep 2011 12:00 AM |
| Wait, but I don't want the script parent to be affected, I want what it's touching to be affected. |
|
|
| Report Abuse |
|
|
getkoed
|
  |
| Joined: 18 Feb 2010 |
| Total Posts: 2298 |
|
|
| 01 Sep 2011 12:10 AM |
The toucher = affected?
Unanchors all parts of toucher ===================
script.Parent.Touched:connect(function(hit) p = hit.Parent:GetChildren() for i = 1, #p do if (p[i].className == "Part") then p[i].Anchored = false end end end)
Kills the toucher ==========
script.Parent.Touched:connect(function(hit) local h = hit.Parent:findFirstChild("Humanoid") if (h ~= nil) then h.Health = 0 end end)
Freezes the toucher ============
script.Parent.Touched:connect(function(hit) local h = hit.Parent:findFirstChild("Humanoid") if (h ~= nil) then h.WalkSpeed = 0 end local p = hit.Parent:GetChildren() for i = 1, #p do if (p[i].className == "Part") then p[i].Reflectance = 1 end end end)
Makes toucher invisible ==============
script.Parent.Touched:connect(function(hit) local p = hit.Parent:GetChildren() for i = 1, #p do if (p[i].className == "Part") then p[i].Transparency = 1 end end end)
I don't know really of all these scripts work, because I didn't test them, but I guess they will. |
|
|
| Report Abuse |
|
|
|
| 01 Sep 2011 12:12 AM |
function onTouched(part) if part.Locked == false then part.Anchored = true --this was the line. It's part.Anchored not part:Anchored. end end |
|
|
| Report Abuse |
|
|
| |
|