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: Would this disable my damage script in my sword?

Previous Thread :: Next Thread 
pokemonmaster61550 is not online. pokemonmaster61550
Joined: 17 Oct 2008
Total Posts: 6058
16 Nov 2012 06:55 PM
function touch()
script.Parent:game.StarterPack.Sword.SwordScript.Disabled = true()
end

script.Parent.Touched:connect(touch)


----------------------------------------------------------------------------------------------------

the sword is the tool and the SwordScript is the script
Report Abuse
Raphael7 is not online. Raphael7
Joined: 03 Dec 2008
Total Posts: 2479
16 Nov 2012 07:02 PM
It would but the true part is wrong, it shouldn't be true() but true.

And also the location is wrong. And also if you mean game.StarterPack it would change the scripting in the starterpack not the one in your backpack so if you died it would change everyone's sword. But if you accessed it from your backpack, it will only change yours and you don't have to die. So it'd be like this

function Touch(p)
if game.Players:findFirstChild(p.Parent.Name)~=nil then
if p.Backpack:findFirstChild("Sword")~=nil then
sword = p.Backpack.Sword
sword.SwordScript.Disabled = true
end
end
end
script.Parent.Touched:connect(Touch)
Report Abuse
pokemonmaster61550 is not online. pokemonmaster61550
Joined: 17 Oct 2008
Total Posts: 6058
16 Nov 2012 07:04 PM
OMG you are such a awesome-o!!!!!!!!!!

Thanks :)
Report Abuse
Raphael7 is not online. Raphael7
Joined: 03 Dec 2008
Total Posts: 2479
16 Nov 2012 07:04 PM
Read what I said, not just the script. It'll help you.
Report Abuse
pokemonmaster61550 is not online. pokemonmaster61550
Joined: 17 Oct 2008
Total Posts: 6058
16 Nov 2012 07:09 PM
why did u have 3 ends?

are the nils functions? and the on touch?
Report Abuse
Raphael7 is not online. Raphael7
Joined: 03 Dec 2008
Total Posts: 2479
16 Nov 2012 08:45 PM
I had 3 ends because

a function needed an end, I don't know how to explain it. But anyways I'll tell you what you need ends with.

You need ends with...
function
for
if

I think that's all, there's more I believe but that's what I use most of the time.
It's basically like a closing sentence but in lua.

Nils basically mean n/a or it could mean that does not exist.

So if it was "if game.Players:findFirstChild(p.Name)~=nil then" it would translate to...
if game > Players > found > p.Name > does not equal to n/a then
Like a sentence.

What do you mean by OnTouch?
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
16 Nov 2012 09:15 PM
^+while
Report Abuse
Raphael7 is not online. Raphael7
Joined: 03 Dec 2008
Total Posts: 2479
16 Nov 2012 09:19 PM
ohyup. that too.
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
16 Nov 2012 09:21 PM
Obviously, he doesn't know AS much about Lua.

When you create a function called OnTouch

function OnTouch()

OnTouch is just a name, you can create varieties of functions from cat, to dog, from building, to skyscraper. If there is an argument, you would put it within the parenthesis.

function [Function Name](Argument)
Report Abuse
epicfail22 is not online. epicfail22
Joined: 25 Sep 2009
Total Posts: 3739
17 Nov 2012 11:14 AM
Differentiating functions from events are Lua beginners' main problem.
Report Abuse
Jonah13249 is not online. Jonah13249
Joined: 09 Oct 2009
Total Posts: 2105
17 Nov 2012 11:51 AM
Exactly. C:
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