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 » Scripters
Home Search
 

Re: Touched is glitchy

Previous Thread :: Next Thread 
icekiller8002 is not online. icekiller8002
Joined: 22 Jan 2013
Total Posts: 6636
11 Sep 2015 08:48 PM
script.Parent.Touched:connect(function(part)
wait(0)
if part.Name == "Food" then
wait(0)
print('Food eaten :D')
script.Parent.SizeV.Value = script.Parent.SizeV.Value + 1
part:Destroy()
end
end)

it's supposed to work, but it doesn't for some stupid reason



would you like a cup o' t? (っ ◔◡◔) っ
Report Abuse
icekiller8002 is not online. icekiller8002
Joined: 22 Jan 2013
Total Posts: 6636
11 Sep 2015 08:48 PM
and there's no errors



would you like a cup o' t? (っ ◔◡◔) っ
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
11 Sep 2015 08:48 PM
You touch multiple things at once.

Use a debounce boolean or function.

Someone post the function.
Report Abuse
icekiller8002 is not online. icekiller8002
Joined: 22 Jan 2013
Total Posts: 6636
11 Sep 2015 08:49 PM
well, in the output there's no errors



would you like a cup o' t? (っ ◔◡◔) っ
Report Abuse
0supadude0 is not online. 0supadude0
Joined: 11 Aug 2010
Total Posts: 649
11 Sep 2015 08:52 PM
wait(0) why

There mustn't be anything called 'Food' touching it
Put a print before your conditional to print the names of every part which does touch it
Report Abuse
icekiller8002 is not online. icekiller8002
Joined: 22 Jan 2013
Total Posts: 6636
11 Sep 2015 08:52 PM
still didn't work

debounce = false
script.Parent.Touched:connect(function(part)
wait(0)
if debounce == false then
debounce = true
if part.Name == "Food" then
wait(0)
print('Food eaten :D')
script.Parent.SizeV.Value = script.Parent.SizeV.Value + 1
part:Destroy()
debounce = false
end
end
end)



would you like a cup o' t? (っ ◔◡◔) っ
Report Abuse
icekiller8002 is not online. icekiller8002
Joined: 22 Jan 2013
Total Posts: 6636
11 Sep 2015 08:53 PM
ok, i'll try removing wait(0) and putting the name check before debounce



would you like a cup o' t? (っ ◔◡◔) っ
Report Abuse
icekiller8002 is not online. icekiller8002
Joined: 22 Jan 2013
Total Posts: 6636
11 Sep 2015 08:53 PM
nope, that still didn't work...

debounce = false
script.Parent.Touched:connect(function(part)
if part.Name == "Food" then
if debounce == false then
debounce = true
print('Food eaten :D')
script.Parent.SizeV.Value = script.Parent.SizeV.Value + 1
part:Destroy()
debounce = false
end
end
end)



would you like a cup o' t? (っ ◔◡◔) っ
Report Abuse
amanda is not online. amanda
Joined: 21 Nov 2006
Total Posts: 5925
11 Sep 2015 08:54 PM
Put the script in the food instead of wherever it is now(your torso?).

And then put a debounce.
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
11 Sep 2015 08:55 PM
Without a debounce it still should work, @idiot above


Look at your output
Report Abuse
icekiller8002 is not online. icekiller8002
Joined: 22 Jan 2013
Total Posts: 6636
11 Sep 2015 08:55 PM
it's a cell, agar.io re-creation :P

but I tried that, i'll try again



would you like a cup o' t? (っ ◔◡◔) っ
Report Abuse
0supadude0 is not online. 0supadude0
Joined: 11 Aug 2010
Total Posts: 649
11 Sep 2015 08:56 PM
I meant do this

script.Parent.Touched:connect(function(part)
print(part.Name)
if part.Name == "Food" then
print('Food eaten :D')
script.Parent.SizeV.Value = script.Parent.SizeV.Value + 1
part:Destroy()
end
end)
Report Abuse
icekiller8002 is not online. icekiller8002
Joined: 22 Jan 2013
Total Posts: 6636
11 Sep 2015 08:57 PM
let me try a local script in the starterpack that follows the touched action of the cell



would you like a cup o' t? (っ ◔◡◔) っ
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
11 Sep 2015 08:58 PM
e.e what why are you useing localscript for a part in workspace no dont do that
Report Abuse
icekiller8002 is not online. icekiller8002
Joined: 22 Jan 2013
Total Posts: 6636
11 Sep 2015 09:00 PM
idk, roblox must've broke it or somethin



would you like a cup o' t? (っ ◔◡◔) っ
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
11 Sep 2015 09:02 PM
@joey
Do you want multiple hit events to do stuff?

I touch one can of food, and before it :Destroy()s it sends another signal. This will cause an error of "Can't index Destroy()" (perhaps) and will give the food twice (perhaps).

It depends.
Report Abuse
MrJoeyJoeJoey is not online. MrJoeyJoeJoey
Joined: 20 Aug 2011
Total Posts: 20787
11 Sep 2015 09:03 PM
If he touches it first it will still print, but we dont know how many times it will be printed before its deleted
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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