Hello, I know maybe this question is like...unnecessary but J just wanted to know...How can we know the script, like the EXACT script, for example...
Make a kill brick
How will.I know the script??
Here is my try...
Parent.Parent.killplayer1touch End)
Don't expect to know how to script in just under a week. With all things, scripting takes time to master. However, don't feel overwhelmed because all scripters were in your exact position now. I even asked a similar question to this when I first wanted to learn how to script. In other words, no one is born already knowing how to script.
With that said, here is how I became sufficiently proficient in scripting:
I read the basics of scripting from here: http://wiki.roblox.com/index.php?title=Scripting_Book/Contents. I opened Roblox studio and practiced what this website taught me and I encourage you to do the same. Don't do it all at once though. Take it one step at a time so you don't overwhelm yourself.
If I had questions or struggled, I'd post my question along with my script on here and learn from my mistakes.
I used Roblox wiki as a reference as I script. For example, if I'm writing a script and wanted to use a function such as math.random()
but forgot what it does, I'd simply search on Google the following: "roblox wiki math.random" and find the webpage for it. Try this right now.
Repeat steps 1-3 and keep practicing! You'll get it eventually, I promise.
When you've become comfortable with scripting, go through this site and try to attempt answering questions.
If you don't know the answer to someone's question, use your resources: Roblox wiki, your mind to think of a creative solution, Roblox studio to play around and test things out. I teach myself and the asker once I figure out a solution to their question(s). This helps expand my knowledge on scripting.
By the way, this is how you make a script that will ultimately kill your player once they touch the script's parent (or the object that the script is placed under):
function thisIsAFunction(characterBodyPart) --I'm just creating a function and naming it whatever I want. Inside the parenthesis is the subject of the function (which is the character's arm or leg that touches the object). local thisIsJustAName = characterBodyPart.Parent --I want the whole character though, not just the body part. I'm indexing this under the name of 'thisIsJustAName' (I could name it whatever I want). local humanoid = thisIsJustAName.Humanoid --I'm indexing again. I want to access the health of the character, which is located under humanoid. Remember thisIsJustAName is a shortcut for 'characterBodyPart.Parent'. humanoid.Health = 0 --Setting the health equal to 0. The player will die. end --After every function, you place an 'end' so the computer knows when the function ends. Otherwise, the computer will get confused! script.Parent.Touched:Connect(thisIsAFunction) --'script.Parent' is the object (or brick/part/etc.). 'Touched' is a special term in scripting, this is called an Event. ':Connect(thisIsAFunction)' will connect the event to the function I just wrote. Basically, every time the object is Touched, the computer will connect to my function and run the code that is written inside it.
Your final script is (without the comments):
function myFunction(characterBodyPart) local humanoid = characterBodyPart.Parent.Humanoid humanoid.Health = 0 end script.Parent.Touched:Connect(myFunction)
I hope you learned something! Also, once you accumulate more scripting knowledge, you will begin to write the above script in a better, more efficient way. This script is written in a way as to ease you into scripting. Good luck! :-)
this:
script.Parent.Touched:Connect(function(part) if part.ClassName == "Part" then part.Parent:WaitForChild("Humanoid").Health = 0 end end
This is what happens: Part is touched then Class Name is defined to stop from confusion when touching hats within parts.... then Change the humanoids health to zero aka kill person.
You can learned by looking at each function, use them, read them, and you'll learn, it's not that difficult.
Look at the roblox wiki. The roblox wiki cookbook and plenty of other articles on there will help you. Click here to enter the roblox wiki! Click here to enter the roblox wiki's cookbook.
Locked by User#24403
This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.
Why was this question closed?