✓ Accepted answer
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)
local thisIsJustAName = characterBodyPart.Parent
local humanoid = thisIsJustAName.Humanoid
humanoid.Health = 0
end
script.Parent.Touched:Connect(thisIsAFunction)
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! :-)
5 comments
http://wiki.roblox.com/index.php?title=API:Class_reference
Thank you!
"parent.Parent.killplayer1touch" ok thats cool.
WOAHHHHHHHHHHHHHHHHHHHHHHHHHHH DJ MUSA, I got u dude, ill help you on everything
Lol thanks great.