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

Child is not a valid member of character after they die?

Asked by 2 years ago

I have this here script that is supposed to grab players when the vampire player touches them while in beast mode. But the problem is that when a player dies (grabbed player or vampire player) the script starts bugging out and saying that the child of the character is not valid. Any way to work around this?

pictures of errors

001local grabblock = script.Parent.Torso
002local vampchar = script.Parent
003local vampplayer = game.Players:GetPlayerFromCharacter(vampchar)
004local BeastEvent = game.ReplicatedStorage.Events.BeastMode
005local cd = false
006local players = game:GetService("Players")
007if vampchar.charactervalues:WaitForChild("Role").Value ~= "Vampire" then
008    script.Disabled = true
009end
010grabblock.Touched:Connect(function(v1)
011    local v2 = v1.Parent
012    local v3 = players:GetPlayerFromCharacter(v2)
013    if vampchar:FindFirstChild("charactervalues").Grabbing.Value == true then return end
014   if v2:FindFirstChild("Humanoid") then
015        if vampchar.charactervalues.BeastMode.Value == true and v2.charactervalues.Role.Value ~= "Vampire" and vampchar.charactervalues.Grabbing ~= true and v2.Humanoid.Health ~= 0 and (not v2:FindFirstChild("FF")) and (v2.charactervalues.Grabbed.Value ~=true) then
View all 152 lines...
1
check if the character is alive or not then continue Puppynniko 1059 — 2y
0
when i try to check the humanoids health it pops up the same "humanoid is not a valid member of character" Uniplier 83 — 2y
0
it might be the ragdoll script im using. Uniplier 83 — 2y

1 answer

Log in to vote
0
Answered by 2 years ago

There was a ragdoll script that i was using that deleted the character's humanoid on death. I removed the script and will now look for a different one or make my own.

Ad

Answer this question