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: Y U NO WERK!!1!

Previous Thread :: Next Thread 
BladeXE is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
17 Feb 2014 02:25 PM
this is if they touch a block :|
Report Abuse
subenari is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. 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 is not online. BladeXE
Joined: 22 Dec 2012
Total Posts: 3857
17 Feb 2014 02:51 PM
end

or not :3
Report Abuse
KEVEKEV77 is not online. 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 is not online. KEVEKEV77
Joined: 12 Mar 2009
Total Posts: 6961
17 Feb 2014 02:57 PM
he thinks you CANT*
Report Abuse
BladeXE is not online. 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
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