local BodyParts = {h.Parent["Right Arm"], h.Parent["Left Arm"], h.Parent.Torso, h.Parent["Left Leg"], h.Parent["Right Leg"]}
local BodyPart = BodyParts(math.random(1, 5))
I know I'm doing this wrong so please help me.
local BodyParts = {h.Parent["Right Arm"], h.Parent["Left Arm"], h.Parent.Torso, h.Parent["Left Leg"], h.Parent["Right Leg"]}
local BodyPart = BodyParts(math.random(1, 5))
I know I'm doing this wrong so please help me.
You almost have it. All you need to change is the way you're trying to access the table. You're attempting to do so with parentheses. To access a table you need to use brackets. So, your code should look like this:
local BodyParts = {h.Parent["Right Arm"], h.Parent["Left Arm"], h.Parent.Torso, h.Parent["Left Leg"], h.Parent["Right Leg"]}
local BodyPart = BodyParts[math.random(1, 5)]
Anyways, that's it. If you have any further problems/questions, please leave a comment below and I'll see what I can do. Hope I helped :P
####-Dyler3
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Thanks for the fastest response in my ScriptHelpers history
Lol no problem. Glad I could help :P