|
| 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 |
|
|
|
| 11 Sep 2015 08:48 PM |
and there's no errors
would you like a cup o' t? (っ ◔◡◔) っ |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2015 08:48 PM |
You touch multiple things at once.
Use a debounce boolean or function.
Someone post the function. |
|
|
| Report Abuse |
|
|
|
| 11 Sep 2015 08:49 PM |
well, in the output there's no errors
would you like a cup o' t? (っ ◔◡◔) っ |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 11 Sep 2015 08:55 PM |
Without a debounce it still should work, @idiot above
Look at your output |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 11 Sep 2015 09:00 PM |
idk, roblox must've broke it or somethin
would you like a cup o' t? (っ ◔◡◔) っ |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 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 |
|
|