Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i get the left arm of my character?

Asked by 5 years ago
Edited 5 years ago

I'm trying to make my characters left arm turn neon but it keeps saying " 00:04:41.981 - LeftArm is not a valid member of Model"

So how do i select my characters left arm?

I'm using R6

1local players = game.Players.LocalPlayer
2local character = players.Character
3local UIS = game:GetService("UserInputService")
4 
5UIS.InputBegan:Connect(function(key)
6    if key.KeyCode == Enum.KeyCode.T then
7        character.LeftArm.Material = Enum.Material.Neon
8    end
9end)

2 answers

Log in to vote
5
Answered by
Thernus 75
5 years ago
Edited 5 years ago

Hey! This seems like an issue because you are referring to a part that does not exist on R15 avatars. If you are using R6, just let me know and I can try to figure out the issue from there.

When Roblox changed to R15, it turned both arms into 3 separate parts to allow for more freedom with animation. These parts are LeftUpperArm, LeftLowerArm, and LeftHand.

To make the entire left arm neon, you can do this:

01local players = game.Players.LocalPlayer
02local character = players.Character
03local UIS = game:GetService("UserInputService")
04 
05UIS.InputBegan:Connect(function(key)
06    if key.KeyCode == Enum.KeyCode.T then
07        character["LeftUpperArm"].Material = Enum.Material.Neon
08        character["LeftLowerArm"].Material = Enum.Material.Neon
09        character["LeftHand"].Material = Enum.Material.Neon
10    end
11end)

EDIT: As you are using R6, this issue is because there is a space in "Left Arm".

To refer to an object with a space, you should use character["Left Arm"] as opposed to character.Left Arm.

1local players = game.Players.LocalPlayer
2local character = players.Character
3local UIS = game:GetService("UserInputService")
4 
5UIS.InputBegan:Connect(function(key)
6    if key.KeyCode == Enum.KeyCode.T then
7        character["Left Arm"].Material = Enum.Material.Neon
8    end
9end)
0
Best tutorial I ever seen. Upvoted immediately without thinking. Xapelize 2658 — 5y
0
I'm using R6 Jiro_Snake 4 — 5y
0
Edited to include what would work for R6 Thernus 75 — 5y
Ad
Log in to vote
2
Answered by 5 years ago
Edited 5 years ago

Thernus's Answer is pretty straight forward except for the fact that what if you wanted to use R6 and R15?

Thernus is not wrong in any sort of way I am just going to show you what you can incorporate for improvement a humanoid has a property called RigType you can actually detect if they are either R6 or R15 and you would do it like this

01local player = game.Players.LocalPlayer
02local character = player.Character or player.CharacterAdded:Wait()
03 
04-- Have this inside your inputbegan
05local humanoid = character:FindFirstChild("Humanoid")
06if humanoid then
07    if humanoid.RigType == Enum.HumanoidRigType.R6 then -- Is a R6 character.
08        -- Assign variables to the body parts in R6; do desired task
09    elseif humanoid.RigType == Enum.HumanoidRigType.R15 then -- Is a R15 character.
10        -- Assign variables to the body parts in R15; do desired task
11    end
12end

RigType

Enum reference

If this helped an upvote or solved would be greatly appreciated. Good luck!

  • Best Regards, -Syn
0
Great thinking! I completely forgot some games use both R6 and R15. Thernus 75 — 5y

Answer this question