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 4 years ago

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

01local DB = false
02 
03game.ReplicatedStorage.PunchEvent.OnServerEvent:Connect(function(plr,Touch)
04    plr.Character.RightHand.Touched:connect(function(hit)
05        if hit.Parent ~= plr.Character then
06            if hit.Parent:FindFirstChild("Humanoid") then
07                if DB == false then
08                    DB = true
09                    hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 10
10                    wait(.6)
11                    DB = false
12                end
13            end
14        end
15    end)
16end)

2 answers

Log in to vote
1
Answered by
MattVSNNL 620 Moderation Voter
4 years ago
Edited 4 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

01local DB = false
02 
03game.ReplicatedStorage.PunchEvent.OnServerEvent:Connect(function(plr,Touch)
04    plr.Character:WaitForChild("Right Hand").Touched:connect(function(hit)
05        if hit.Parent ~= plr.Character then
06            if hit.Parent:FindFirstChild("Humanoid") then
07                if DB == false then
08                    DB = true
09                    hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 10
10                    wait(.6)
11                    DB = false
12                end
13            end
14        end
15    end)
16end)
0
now im getting the error Right Hand is not a valid member of Model "Workspace.ItzSulfonic" ItzSulfonic 61 — 4y
0
Sorry I'll fix it MattVSNNL 620 — 4y
0
That worked, Thanks alot. im getting an infinite yield on right hand but other than that there's no more errors. ItzSulfonic 61 — 4y
0
Can you accept my anwser then? I'd appreciate it MattVSNNL 620 — 4y
Ad
Log in to vote
0
Answered by
KixWater 126
4 years ago

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

01local DB = false
02 
03game.ReplicatedStorage.PunchEvent.OnServerEvent:Connect(function(plr,Touch)
04    plr.Character.Right Arm.Touched:Connect(function(hit) -- And yes it has a space for some reason, that's Roblox's fault
05        if hit.Parent ~= plr.Character then
06            if hit.Parent:FindFirstChild("Humanoid") then
07                if DB == false then
08                    DB = true
09                    hit.Parent.Humanoid.Health = hit.Parent.Humanoid.Health - 10
10                    wait(.6)
11                    DB = false
12                end
13            end
14        end
15    end)
16end)

Answer this question