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

Punching-Script, saying that the left leg is not a valid unit of the character?

Asked by 4 years ago

To expand, i created a tool that when you press it, it will fire an animation and make the other player take damage.

It says the players left leg is not a valid member of the character.

Here's the Local Script

local Animation = script.Animation
local Replicated = game:GetService("ReplicatedStorage")
local RemoteEvent = Replicated.Remotes.Punch

local Debounce = false

wait(2)

local Humanoid = game.Players.LocalPlayer.Character.Humanoid

script.Parent.Activated:Connect(function()
    if not Debounce then
        Debounce = true

    local AnimationTrack = Humanoid:LoadAnimation(Animation)
    RemoteEvent:FireServer()
    wait(2)
    Debounce = false 
    end
end)

Here's the server script:

local Tools = game:GetService("ReplicatedStorage"):WaitForChild("Tools")
local RemoteEvent = game:GetService("ReplicatedStorage").Remotes.Punch
local Animation = Tools.SuperPunch.PunchConnecter.Animation

wait(1)

RemoteEvent.OnServerEvent:Connect(function(player)
    local Hum = player.Character.Humanoid
    local AnimationTrack = Hum:LoadAnimation(Animation)
    AnimationTrack:Play()
    print("Hello!")

    if AnimationTrack.IsPlaying then
        local LeftArm = player.Character["Left Arm"]

        LeftArm.Touched:Connect(function()

            Hum:TakeDamage(10)
        print("Damaged another player!")
    end)
        end
        end
0
aren't they using upperleftarm and lowerleftarm now?? aprilsfooled 29 — 4y
0
yes, and also no, more on that in my answer proqrammed 285 — 4y

2 answers

Log in to vote
1
Answered by 4 years ago

Hello!

This might be because your game is r15 and not r6. In r15, Left Arm does not exist - there is Left Lower arm and Left Upper Arm. In r6, it does. That is probably why there is an error when you try to find it. There are two methods to fix it.

In order to change your game to r6, in studio at the top of the screen press "home" and then find the cog/gear/settings icon called game settings and click it. Then, when the game settings window pops up, click avatar and then r6. Save your settings and you should be good to go.

Note that if your animations are r15, you should do these instructions below to make your script r15 compatible. Change player.Character["Left Arm"] to player.Character["LeftHand"]. If this hitbox is too small, consider creating a transparent part and welding it to the arm and using that for collision detection instead.

If you have any questions or if anything doesn't work feel free to comment or ask for my discord. I hope this helps you! :D

-ProqrammedGreen

0
This is basically my answer but more explained. Idc though. youtubemasterWOW 2741 — 4y
0
Hey don't be ashamed you're answer was really good aswell! maxpax2009 340 — 4y
Ad
Log in to vote
0
Answered by 4 years ago

Perhaps you have to make your character R6. R15 characters don't have a body part called Left Arm.

0
Maxpax2009, please read my answer for more details and another method incase your animations are r15 and changing it to r6 would make your animations incompatible. proqrammed 285 — 4y

Answer this question