BladeXE
|
  |
| Joined: 22 Dec 2012 |
| Total Posts: 3857 |
|
|
| 17 Feb 2014 02:18 PM |
while true do repeat function onTouch() if LocalPlayer.Sword = true then LocalPlayer.Sword:destroy() end
this is to remove a specific tool named "Sword" |
|
|
| Report Abuse |
|
|
subenari
|
  |
| Joined: 23 Mar 2011 |
| Total Posts: 116 |
|
|
| 17 Feb 2014 02:18 PM |
if LocalPlayer.Sword = true then
what is this |
|
|
| Report Abuse |
|
|
BladeXE
|
  |
| Joined: 22 Dec 2012 |
| Total Posts: 3857 |
|
|
| 17 Feb 2014 02:21 PM |
| If the player has the sword, then do it. |
|
|
| Report Abuse |
|
|
subenari
|
  |
| Joined: 23 Mar 2011 |
| Total Posts: 116 |
|
|
| 17 Feb 2014 02:23 PM |
Pl = game.Players.LocalPlayer while true do wait() if Pl.Backpack:findFirstChild("Sword") then Pl.Backpack.Sword:destroy() end end
Ok, that makes some sense now. The reason I didn't get it earlier was because of the countless errors
|
|
|
| Report Abuse |
|
|
BladeXE
|
  |
| Joined: 22 Dec 2012 |
| Total Posts: 3857 |
|
|
| 17 Feb 2014 02:25 PM |
| this is if they touch a block :| |
|
|
| Report Abuse |
|
|
subenari
|
  |
| Joined: 23 Mar 2011 |
| Total Posts: 116 |
|
|
| 17 Feb 2014 02:27 PM |
you must be novice
deb = false script.Parent.Touched:connect(function(hit) if not deb then deb = true Pl = game.Players:GetPlayerFromCharacter(hit.Parent) wait() if Pl.Backpack:findFirstChild("Sword") then Pl.Backpack.Sword:destroy() end end end) |
|
|
| Report Abuse |
|
|
trogyssy
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 2322 |
|
|
| 17 Feb 2014 02:27 PM |
Let's figure out how to do this.
First of all, unless you are changing a value, you use == instead of =.
local Sword = LocalPlayer:FindFirstChild(Sword)
This part finds the first child of LocalPlayer that is named "Sword" and assigns it to a variable, Sword
Sword:Destroy()
Destroys the Sword
script.Parent.Touched:connect(RemoveSword) Responds to the touch
Now the full script:
function RemoveSword(LocalPlayer) local Sword = LocalPlayer:FindFirstChild(Sword) Sword:Destroy() end script.Parent.Touched:connect(RemoveSword)
Try this and see if it works :)
|
|
|
| Report Abuse |
|
|
trogyssy
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 2322 |
|
|
| 17 Feb 2014 02:28 PM |
| lol never mind me. I'm usually wrong XD |
|
|
| Report Abuse |
|
|
trogyssy
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 2322 |
|
|
| 17 Feb 2014 02:29 PM |
| sube's is more likely to work than mine |
|
|
| Report Abuse |
|
|
subenari
|
  |
| Joined: 23 Mar 2011 |
| Total Posts: 116 |
|
|
| 17 Feb 2014 02:29 PM |
| The problem with that is that you don't use LocalScripts for Touched scripts |
|
|
| Report Abuse |
|
|
BladeXE
|
  |
| Joined: 22 Dec 2012 |
| Total Posts: 3857 |
|
|
| 17 Feb 2014 02:32 PM |
function touch(c) -- c is the thing that touched it if c.Parent.Sword then -- checks if the c's parent has a humanoid c.Parent.Sword:remove() -- sets the humanoids health to 0 end -- end the 'if' statement end -- ends the function
script.parent.Touched:connect(touch)
that should work. |
|
|
| Report Abuse |
|
|
subenari
|
  |
| Joined: 23 Mar 2011 |
| Total Posts: 116 |
|
|
| 17 Feb 2014 02:37 PM |
dude stop being so tenacious about your conditional statements
two people already stated that you need to use findFirstChild |
|
|
| Report Abuse |
|
|
BladeXE
|
  |
| Joined: 22 Dec 2012 |
| Total Posts: 3857 |
|
| |
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
|
| 17 Feb 2014 02:57 PM |
this guy thinks you can use MoveTo on a humanoid and cussed over it
What a frickin noob |
|
|
| Report Abuse |
|
|
KEVEKEV77
|
  |
| Joined: 12 Mar 2009 |
| Total Posts: 6961 |
|
| |
|
BladeXE
|
  |
| Joined: 22 Dec 2012 |
| Total Posts: 3857 |
|
|
| 17 Feb 2014 03:02 PM |
Kevek, never said that, I said you were doing it wrong. I obviously wanted it to teleport. Also, you cussed. |
|
|
| Report Abuse |
|
|