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

How to fix RightHand is not a valid member?

Asked by 3 years ago

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

Log in to vote
1
Answered by
MattVSNNL 620 Moderation Voter
3 years ago
Edited 3 years ago

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)
0
now im getting the error Right Hand is not a valid member of Model "Workspace.ItzSulfonic" ItzSulfonic 61 — 3y
0
Sorry I'll fix it MattVSNNL 620 — 3y
0
That worked, Thanks alot. im getting an infinite yield on right hand but other than that there's no more errors. ItzSulfonic 61 — 3y
0
Can you accept my anwser then? I'd appreciate it MattVSNNL 620 — 3y
Ad
Log in to vote
0
Answered by
KixWater 126
3 years ago

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)

Answer this question