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

Why it always says that the "RightLeg" is not valid member of a Model? TYIA

Asked by 6 years ago
math.randomseed(tick())

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local punchEvent = Instance.new("RemoteEvent", ReplicatedStorage)
punchEvent.Name = "PunchEvent"

local animations = {01741614100,01741629151,1741813502}

local function onPunchFired(plr)
    local char = game.Workspace:FindFirstChild(plr.Name)
    local humanoid = char.Humanoid
    local animation = Instance.new("Animation")
    local picked = math.random(1, #animations)
    animation.AnimationId = "http://roblox.com/asset/?id="..animations[picked]
    local animTrack = humanoid:LoadAnimation(animation)
    animTrack:Play()
    local dmgScript = script.DmgScript:Clone()
    if picked == 1 then
        dmgScript.Parent = char.RightHand
    elseif picked == 2 then
        dmgScript.Parent = char.LeftHand
    elseif picked == 3 then
        dmgScript.Parent = char.RightLeg
    end
    dmgScript.Disabled = false
    wait(0.4)
    dmgScript:Destroy()
end

punchEvent.OnServerEvent:Connect(onPunchFired)


2 answers

Log in to vote
1
Answered by 6 years ago

In an R15 rig, RightLeg is not a thing.

Consider changing it to RightUpperLeg or RightLowerLeg

0
Thanks bro. It Works OniSanYamate -17 — 6y
Ad
Log in to vote
-1
Answered by 6 years ago

If you want it to work with R6, then you need to do the following:

char["Right Leg"]

to access the right leg. This is how you access objects with spaces in their names. It doesn't always have to be the right leg to use that. You could also do:

workspace["Ob ject"]

Even if the name of the object doesn't have spaces, you can still use this method. Another method is to use FindFirstChild():

workspace:FindFirstChild('Ob ject').BrickColor = BrickColor.Red()

Hope this helped!

Answer this question