|
| 05 Apr 2014 03:12 PM |
function Touch(x1,y1,w1,h1,x2,y2,w2,h2) local x3 = x1 + w1 local y3 = y1 + h1 local x4 = x2 + w2 local y4 = y2 + h2 return x1 < x4 and x3 > x2 and y1 < y4 and y3 > y2 end
F1 = script.Parent.Frame F2 = script.Parent.Frame2
wait(3) while wait() do F2.Position = F2.Position + UDim2.new(-0.01,0,0,0) end local x1, y1, w1, h1 = F1.Position.X.Offset, F1.Position.Y.Offset, F1.Size.X.Offset, F1.Size.Y.Offset local x2, y2, w2, h2 = F2.Position.X.Offset, F2.Position.Y.Offset, F2.Size.X.Offset, F2.Size.Y.Offset
if Touch(x1,y1,w1,h1,x2,y2,w2,h2) then F2:Remove() end
|
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Apr 2014 03:15 PM |
| So like when the GUI touches the other GUI it removes it. |
|
|
| Report Abuse |
|
|
Kingmouli
|
  |
| Joined: 28 Sep 2012 |
| Total Posts: 1292 |
|
|
| 05 Apr 2014 03:18 PM |
| If there isn't any output, there might be a logic error. Add prints everywhere. |
|
|
| Report Abuse |
|
|
Kingmouli
|
  |
| Joined: 28 Sep 2012 |
| Total Posts: 1292 |
|
|
| 05 Apr 2014 03:19 PM |
| Oh and add the lines under the while loop inside of the while loop |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2014 03:22 PM |
Here it is:
Still won't work
function Touch(x1,y1,w1,h1,x2,y2,w2,h2) local x3 = x1 + w1 local y3 = y1 + h1 local x4 = x2 + w2 local y4 = y2 + h2 return x1 < x4 and x3 > x2 and y1 < y4 and y3 > y2 end print 'x3,4 all of that'
F1 = script.Parent.Frame F2 = script.Parent.Frame2 print 'Frames'
wait(3) while wait() do F2.Position = F2.Position + UDim2.new(-0.01,0,0,0) end
print 'Movement' local x1, y1, w1, h1 = F1.Position.X.Offset, F1.Position.Y.Offset, F1.Size.X.Offset, F1.Size.Y.Offset local x2, y2, w2, h2 = F2.Position.X.Offset, F2.Position.Y.Offset, F2.Size.X.Offset, F2.Size.Y.Offset print 'Offset' if Touch(x1,y1,w1,h1,x2,y2,w2,h2) then F2:Remove() end print 'Removed' |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2014 03:23 PM |
function Touch(x1,y1,w1,h1,x2,y2,w2,h2) local x3 = x1 + w1 local y3 = y1 + h1 local x4 = x2 + w2 local y4 = y2 + h2 return x1 < x4 and x3 > x2 and y1 < y4 and y3 > y2 end print 'x3,4 all of that'
F1 = script.Parent.Frame F2 = script.Parent.Frame2 print 'Frames' ------------------------------------------------ wait(3)
------------------------------------------------ while wait() do F2.Position = F2.Position + UDim2.new(-0.01,0,0,0) end ------------------------------------------------
print 'Movement'
------------------------------------------------ local x1, y1, w1, h1 = F1.Position.X.Offset, F1.Position.Y.Offset, F1.Size.X.Offset, F1.Size.Y.Offset local x2, y2, w2, h2 = F2.Position.X.Offset, F2.Position.Y.Offset, F2.Size.X.Offset, F2.Size.Y.Offset print 'Offset' if Touch(x1,y1,w1,h1,x2,y2,w2,h2) then F2:Remove() end print 'Removed' |
|
|
| Report Abuse |
|
|
Kingmouli
|
  |
| Joined: 28 Sep 2012 |
| Total Posts: 1292 |
|
|
| 05 Apr 2014 03:25 PM |
| I told you to add the lines under the while loop inside of it... |
|
|
| Report Abuse |
|
|
| |
|
|
| 05 Apr 2014 03:27 PM |
| putting lines in will do absolutely nothing WHATSOEVER. |
|
|
| Report Abuse |
|
|
| |
|
Kingmouli
|
  |
| Joined: 28 Sep 2012 |
| Total Posts: 1292 |
|
|
| 05 Apr 2014 03:37 PM |
| Seems you don't understand what I mean... The script isn't working because it is blocked inside the infinitive loop |
|
|
| Report Abuse |
|
|
|
| 05 Apr 2014 03:39 PM |
| Can you try showing me, where you mean in the script by pointing it out, don't fix it though. |
|
|
| Report Abuse |
|
|
| |
|
Kingmouli
|
  |
| Joined: 28 Sep 2012 |
| Total Posts: 1292 |
|
|
| 05 Apr 2014 04:08 PM |
function Touch(x1,y1,w1,h1,x2,y2,w2,h2) local x3 = x1 + w1 local y3 = y1 + h1 local x4 = x2 + w2 local y4 = y2 + h2
return x1 < x4 and x3 > x2 and y1 < y4 and y3 > y2 end
F1 = script.Parent.Frame F2 = script.Parent.Frame2
wait(3) while wait() do F2.Position = F2.Position + UDim2.new(-0.01,0,0,0) local x1, y1, w1, h1 = F1.Position.X.Offset, F1.Position.Y.Offset, F1.Size.X.Offset, F1.Size.Y.Offset local x2, y2, w2, h2 = F2.Position.X.Offset, F2.Position.Y.Offset, F2.Size.X.Offset, F2.Size.Y.Offset
if Touch(x1,y1,w1,h1,x2,y2,w2,h2) then F2:Remove() end end
|
|
|
| Report Abuse |
|
|
|
| 05 Apr 2014 04:12 PM |
GUI collision checks are probably the most painful things to try to use.
If there is nothing wrong in the output then you probably have a logic error, probably in the return statement. Just add a bunch of prints so you can see where the error is. |
|
|
| Report Abuse |
|
|