|
| 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
|
  |
| 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 |
|
|
|
| 16 Nov 2012 07:04 PM |
OMG you are such a awesome-o!!!!!!!!!!
Thanks :) |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 16 Nov 2012 07:09 PM |
why did u have 3 ends?
are the nils functions? and the on touch? |
|
|
| Report Abuse |
|
|
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 |
|
|
| |
|
Raphael7
|
  |
| Joined: 03 Dec 2008 |
| Total Posts: 2479 |
|
| |
|
|
| 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 |
|
|
|
| 17 Nov 2012 11:14 AM |
| Differentiating functions from events are Lua beginners' main problem. |
|
|
| Report Abuse |
|
|
| |
|