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
local players = game.Players.LocalPlayer local character = players.Character local UIS = game:GetService("UserInputService") UIS.InputBegan:Connect(function(key) if key.KeyCode == Enum.KeyCode.T then character.LeftArm.Material = Enum.Material.Neon end end)
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:
local players = game.Players.LocalPlayer local character = players.Character local UIS = game:GetService("UserInputService") UIS.InputBegan:Connect(function(key) if key.KeyCode == Enum.KeyCode.T then character["LeftUpperArm"].Material = Enum.Material.Neon character["LeftLowerArm"].Material = Enum.Material.Neon character["LeftHand"].Material = Enum.Material.Neon end end)
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
.
local players = game.Players.LocalPlayer local character = players.Character local UIS = game:GetService("UserInputService") UIS.InputBegan:Connect(function(key) if key.KeyCode == Enum.KeyCode.T then character["Left Arm"].Material = Enum.Material.Neon end end)
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
local player = game.Players.LocalPlayer local character = player.Character or player.CharacterAdded:Wait() -- Have this inside your inputbegan local humanoid = character:FindFirstChild("Humanoid") if humanoid then if humanoid.RigType == Enum.HumanoidRigType.R6 then -- Is a R6 character. -- Assign variables to the body parts in R6; do desired task elseif humanoid.RigType == Enum.HumanoidRigType.R15 then -- Is a R15 character. -- Assign variables to the body parts in R15; do desired task end end
If this helped an upvote or solved would be greatly appreciated. Good luck!