Hello everyone,
I’m encountering an issue with a script in my Roblox game, and I’m seeking help to resolve it. I have a script that is supposed to make the player’s right arm follow the cursor, but I’m consistently getting an error that says “Right Arm not found in character.” I’ve checked my script, and it seems fine to me, but I can’t figure out what’s causing this problem.
Here’s the relevant part of my script:
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local character = player.Character or player.CharacterAdded:Wait()
local rightArm = character:WaitForChild("Right Arm", 5)
if rightArm then
mouse.Move:Connect(function()
local targetPosition = mouse.Hit.p
local direction = (targetPosition - rightArm.Position).Unit
rightArm.CFrame = CFrame.new(rightArm.Position, targetPosition) * CFrame.Angles(math.pi/2, 0, 0)
end)
else
error("Error: 'Right Arm' not found in character.")
end
I’ve double-checked that “Right Arm” is correctly spelled in the script and that the arm is a part of the character hierarchy. I’ve also tried using the CharacterAdded
event to ensure the character is fully loaded before running the script, but the error still persists.
Any insights or suggestions on what might be causing this issue and how to resolve it would be greatly appreciated. If you have any advice or guidance, please let me know. Thank you in advance for your help.