johnville
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 388 |
|
|
| 08 Nov 2014 03:55 PM |
ok so i have this script ...
db=0
function onTouched(hit) if hit~=nil then if hit.Parent~=nil then if hit.Parent:findFirstChild("Humanoid")~=nil then if game.Players:findFirstChild(hit.Parent.Name)~=nil then if db==0 then db=1 c=hit.Parent:GetChildren() for i = 1, #c do if c[i].className=="Tool" then if c[i]:findFirstChild("Battery")~=nil then c[i]:findFirstChild("Battery").Value=100 end end end wait(0.5) db=0 end end end end end end)
and it suppose to recharge my battery from my tool to 100 but it doesnt work. i added the script inside the part "MASK" if the MASK is touched u get 100 battery. I want the script to be inside the part not outisde. |
|
|
| Report Abuse |
|
|
|
| 08 Nov 2014 03:56 PM |
| You forgot the .Touched event |
|
|
| Report Abuse |
|
|
|
| 08 Nov 2014 03:58 PM |
| part.Touched:connector(onTouched) |
|
|
| Report Abuse |
|
|
johnville
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 388 |
|
|
| 08 Nov 2014 04:03 PM |
the script doesnt look wrong ive tried that and it didnt work.
this was how the script was at first b4 i wanted it to go inside the part
db=0
script.Parent.MASK.Touched:connect(function(hit) if hit~=nil then if hit.Parent~=nil then if hit.Parent:findFirstChild("Humanoid")~=nil then if game.Players:findFirstChild(hit.Parent.Name)~=nil then if db==0 then db=1 c=hit.Parent:GetChildren() for i = 1, #c do if c[i].className=="Tool" then if c[i]:findFirstChild("Battery")~=nil then c[i]:findFirstChild("Battery").Value=100 end end end wait(0.5) db=0 end end end end end end)
i want to make it to where it works inside the mask part
|
|
|
| Report Abuse |
|
|
|
| 08 Nov 2014 04:04 PM |
function onTouched(hit) you need to complete it at the bottom How ever I like to do the functions like this script.Parent.Touched:connect(function(hit)
|
|
|
| Report Abuse |
|
|
|
| 08 Nov 2014 04:05 PM |
Sorry you posted when i was typing mine :P Whats the error |
|
|
| Report Abuse |
|
|
johnville
|
  |
| Joined: 12 Oct 2008 |
| Total Posts: 388 |
|
|
| 08 Nov 2014 04:16 PM |
| i want the script to work inside the part. |
|
|
| Report Abuse |
|
|