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

How Do You Variable The Holder's Humanoid?

Asked by 6 years ago

I am trying to make it so that when you hit a ANOTHER humanoid it would take damage. But it keeps saying,

01:26:43.530 - HumanoidDummy is not a valid member of Model
01:26:43.532 - Stack Begin
01:26:43.533 - Script 'Players.PumpedRedfalconPE.Backpack.ComboTool.Folder.Scripts.Combo Script Version II', Line 35
01:26:43.534 - Stack End
--Here is the Var. I have.
local Char
repeat
    Char = game.Players.LocalPlayer.Character
    wait()
until Char
local humanoid = Char:WaitForChild("Humanoid")
local Animation = game.StarterPack.ComboTool.Folder.Folder["PunchAnimation"]
local AnimationOne = game.StarterPack.ComboTool.Folder.Folder["Dodging Animation"]
local AnimationTwo = game.StarterPack.ComboTool.Folder.Folder["Kicking Finisher"]
local punching = false
local kicking = false
local dodging = false
local punches = 0
local kicks = 0
local HumanoidDummy= workspace.PleaseHurtThem.PleaseHurtMe:WaitForChild("Humanoid")

Also My Code For It:

function onKeyPress(inputObject,gameProcessedEvent)
    if inputObject.KeyCode == Enum.KeyCode.Q then
        local animTrack = humanoid:LoadAnimation(Animation)
        animTrack:Play()
        if dodging == true then 
            print ("It Missed?!")
        elseif dodging == false then
        print ("Punch!")
        print(punches + 1)
        punching = true
        end
    end
end
Char.RightHand.Touched:connect(function(hit)
    if hit.Parent~=Char and hit.Parent:FindFirstChild("Humanoid")~=nil and punching==true then
        hit.Parent.HumanoidDummy:TakeDamage(10)
print("Oof")
    end
end)  

I am new at this just started monthwise, so don't mind the poor craftsmen ship. And please, if there is any Wiki Page or SH Page I can see please link it.

-Regards This Random Guy

Answer this question