generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: What is wrong???

Previous Thread :: Next Thread 
SuperiorEternal is not online. SuperiorEternal
Joined: 22 Aug 2009
Total Posts: 2365
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
SuperiorEternal is not online. SuperiorEternal
Joined: 22 Aug 2009
Total Posts: 2365
05 Apr 2014 03:14 PM
bump
Report Abuse
SuperiorEternal is not online. SuperiorEternal
Joined: 22 Aug 2009
Total Posts: 2365
05 Apr 2014 03:15 PM
So like when the GUI touches the other GUI it removes it.
Report Abuse
Kingmouli is not online. 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 is not online. 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
SuperiorEternal is not online. SuperiorEternal
Joined: 22 Aug 2009
Total Posts: 2365
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
SuperiorEternal is not online. SuperiorEternal
Joined: 22 Aug 2009
Total Posts: 2365
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 is not online. 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
SuperiorEternal is not online. SuperiorEternal
Joined: 22 Aug 2009
Total Posts: 2365
05 Apr 2014 03:26 PM
I did don't you see it
Report Abuse
VerifiedName is not online. VerifiedName
Joined: 26 Jul 2009
Total Posts: 4534
05 Apr 2014 03:27 PM
putting lines in will do absolutely nothing WHATSOEVER.
Report Abuse
SuperiorEternal is not online. SuperiorEternal
Joined: 22 Aug 2009
Total Posts: 2365
05 Apr 2014 03:31 PM
Any ideas?
Report Abuse
Kingmouli is not online. 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
SuperiorEternal is not online. SuperiorEternal
Joined: 22 Aug 2009
Total Posts: 2365
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
SuperiorEternal is not online. SuperiorEternal
Joined: 22 Aug 2009
Total Posts: 2365
05 Apr 2014 03:47 PM
bump11111
Report Abuse
Kingmouli is not online. 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
ForeverDev is not online. ForeverDev
Joined: 04 Oct 2008
Total Posts: 13300
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image