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: StoppedTouching/Loop check for AI pathfinding.

Previous Thread :: Next Thread 
Beauu is not online. Beauu
Joined: 25 Nov 2011
Total Posts: 214
28 Nov 2011 10:30 AM
This is a logic script, it only deals with two physical parts.
It's main purpose is to switch on/off the _G.dream variable and it's always returning false when it prints. :'( All I get is:

Five seconds: false
Five seconds: false
Five seconds: false
Five seconds: false
Five seconds: false
Five seconds: false

Here is the script:

old_d = false;
script.Parent.Touched:connect(function(p)
if (p.Name == 'platform') then
old_d = _G.dream
_G.dream = true;
table.insert(_G.dt, p.Name..''..tostring(#_G.dt))
end
end)
script.Parent.StoppedTouching:connect(function(p)
if (p.Name == 'platform') then
old_d = _G.dream
_G.dream = false;
end
end)
t = 0;
while (wait(1)) do
t = t + 1
if (t == 5) then
print(_G.dream)
elseif (not t == 5 and not old_d == _G.dream) then
print(_G.dream)
end
end

How can decide over what's right, when you're clouding up my mind?
Report Abuse
Beauu is not online. Beauu
Joined: 25 Nov 2011
Total Posts: 214
28 Nov 2011 10:31 AM
My bad, wrong script.

old_d = false;
script.Parent.Touched:connect(function(p)
if (p.Name == 'platform') then
old_d = _G.dream
_G.dream = true;
table.insert(_G.dt, p.Name..''..tostring(#_G.dt))
end
end)
script.Parent.StoppedTouching:connect(function(p)
if (p.Name == 'platform') then
old_d = _G.dream
_G.dream = false;
end
end)
t = 0;
while (wait(1)) do
t = t + 1
if (t == 5) then
t = 0;
print('Five seconds: '.. tostring(_G.dream))
elseif (not t == 5 and not old_d == _G.dream) then
print('Changed: '.. tostring(_G.dream))
end
end

How can decide over what's right, when you're clouding up my mind?
Report Abuse
Miro034 is not online. Miro034
Joined: 07 Oct 2009
Total Posts: 6568
28 Nov 2011 12:06 PM
@_@ what is 'StoppedTouching' event?
Report Abuse
Beauu is not online. Beauu
Joined: 25 Nov 2011
Total Posts: 214
28 Nov 2011 12:08 PM
It's in the ObjectBrowser.

~How can decide over what's right, when you're clouding up my mind?
Report Abuse
eJorge is not online. eJorge
Joined: 09 Jun 2011
Total Posts: 5966
28 Nov 2011 01:45 PM
I suggest using TouchEnded, never heard of StoppedTouching...
Report Abuse
Beauu is not online. Beauu
Joined: 25 Nov 2011
Total Posts: 214
28 Nov 2011 02:08 PM
Pretty sure it's on there....

~How can decide over what's right, when you're clouding up my mind?
Report Abuse
Beauu is not online. Beauu
Joined: 25 Nov 2011
Total Posts: 214
28 Nov 2011 02:11 PM
Oh. Lol. Nevermind. It's deprecated. Didn't see that.

~How can decide over what's right, when you're clouding up my mind?
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