Attempt to index nil with 'RightArm'

I am trying to weld a tool to the player’s hand when it is equipped so I don’t have to use the classic “arm-out” animation. I don’t know what I’ve done wrong so I need some help, I’ve never worked with welds in scripting before.

Here is what’s in the LocalScript under the tool:

local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local character = Player.Character

local part = script.parent.HeldPart-- Handle that you'd be holding

local weld = Instance.new("Weld",part)
weld.Part0 = part --Attach to the handle
weld.Part1 = character["RightArm"] --Attach to the right hand.
weld.C0 = CFrame.new(0, 0, 0) + Vector3.new(0,character["RightArm"].Size.Y/2,0)

image

the character is nil
try this
local character = Player.Character or Player.CharacterAdded:Wait()

This won’t work if you reset unfortunately… I’d rather use a connection to CharacterAdded than using :Wait()

oh yea sorry, forgot this is the starter pack
my bad

I am now getting an error saying "RightArm is not a valid member of Model “Workspace.ScottishKiltBearer” (My character)

read what NN said
that’s what you should do
I forgot you were doing this in starter pack so my method won’t work at the beginning of a script

also check to see what RightArm is actually called in game explorer while testing

It’s just “Right Arm”. I am using R6.

then you forgot to add a space simple

Wha do you mean by this? Should I not use

local character = Player.Character or Player.CharacterAdded:Wait()

no this is good practice, but when you die the character is gone so it won’t work after that unless you change it’s value again

I put a space and it’s still not saying It’s in the model.

I’ve fixed it, I just had to add a WaitForChild: as the right arm needed to load in.