Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to fix RightHand is not a valid member?

I'm getting the error RightHand is not a valid member of Model "Workspace.ItzSulfonic - line 4 R6

local DB = false

game.ReplicatedStorage.PunchEvent.OnServerEvent:Connect(function(plr,Touch)
	plr.Character.RightHand.Touched:connect(function(hit)
		if hit.Parent ~= plr.Character then
			if hit.Parent:FindFirstChild("Humanoid") then
				if DB == false then
					DB = true
					hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 10
					wait(.6)
					DB = false
				end
			end
		end
	end)
end)

2 answers

✓ Accepted answer

The right hand has a space in it so if you wanted it as a right-hand use this code!

Sorry it didn't work for you so I fixed it

local DB = false

game.ReplicatedStorage.PunchEvent.OnServerEvent:Connect(function(plr,Touch)
    plr.Character:WaitForChild("Right Hand").Touched:connect(function(hit)
        if hit.Parent ~= plr.Character then
            if hit.Parent:FindFirstChild("Humanoid") then
                if DB == false then
                    DB = true
                    hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 10
                    wait(.6)
                    DB = false
                end
            end
        end
    end)
end)

4 comments

0

now im getting the error Right Hand is not a valid member of Model "Workspace.ItzSulfonic"

0

Sorry I'll fix it

0

That worked, Thanks alot. im getting an infinite yield on right hand but other than that there's no more errors.

0

Can you accept my anwser then? I'd appreciate it

It's because the right hand is not a member of your character, it's the right arm.

local DB = false

game.ReplicatedStorage.PunchEvent.OnServerEvent:Connect(function(plr,Touch)
    plr.Character.Right Arm.Touched:Connect(function(hit) -- And yes it has a space for some reason, that's Roblox's fault
        if hit.Parent ~= plr.Character then
            if hit.Parent:FindFirstChild("Humanoid") then
                if DB == false then
                    DB = true
                    hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 10
                    wait(.6)
                    DB = false
                end
            end
        end
    end)
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.