CarlosMX
|
  |
| Joined: 30 Apr 2011 |
| Total Posts: 791 |
|
|
| 21 Sep 2013 06:51 PM |
Hi, I'm trying to make this script, so that when a model touches the brick, the model rotates, the thing is, the model bricks are unanchored, so i dont want it falling apart either. The script doesnt' seem to work, no output either.
function onTouched(hit) for _, v in pairs (hit:GetChildren()) do v.Rotation = Cframe.new(0, 30, 0) hit:MakeJoints() end end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 21 Sep 2013 06:51 PM |
If it's unanchored, it will fall.
Just do:
v.CFrame = v.CFrame * CFrame.angles(0, 30, 0) |
|
|
| Report Abuse |
|
|
|
| 21 Sep 2013 06:53 PM |
function onTouched(hit) for _, v in pairs (hit:GetChildren()) do if v:IsA("BasePart") then v.Anchored = true v.CFrame = v.CFrame * CFrame.new(0, 30, 0) coroutine.wrap(function() wait(1/15)v.Anchored=false;end) end end end
script.Parent.Touched:connect(onTouched) |
|
|
| Report Abuse |
|
|
CarlosMX
|
  |
| Joined: 30 Apr 2011 |
| Total Posts: 791 |
|
| |
|