local victim = script.Victim.Value local owner = script.Owner.Value function…
- User
local victim = script.Victim.Value local owner = script.Owner.Value
function RemoveCollar(VictimHasDied) print("Removing collar") script:WaitForChild("RemoveEvent").Value:FireAllClients()
--ResetAnimation if VictimHasDied then local character = victim.Character local animationScript = character:WaitForChild("Animate") animationScript.idle.Animation1.AnimationId = "rbxassetid://180435571" animationScript.idle.Animation2.Weight.Value = 1 animationScript.jump.JumpAnim.AnimationId = "rbxassetid://125750702" animationScript.fall.FallAnim.AnimationId = "rbxassetid://180436148" animationScript.run.RunAnim.AnimationId = "rbxassetid://180426354" animationScript.walk.WalkAnim.AnimationId = "rbxassetid://180426354" end -- victim.Character.Collar:Destroy() script:Destroy()end
function OnVictimDeath() RemoveCollar(true) end
function OnOwnerDeath() RemoveCollar(false) end
victim.Character.Humanoid.Died:Connect(OnVictimDeath) owner.Character.Humanoid.Died:Connect(OnOwnerDeath)
victim.CharacterRemoving:Connect(OnVictimDeath) owner.CharacterRemoving:Connect(OnOwnerDeath)
attempt to index nil with 'WaitForChild' on line 11, this happens when the player leaves the game.
- Assistant
In your current script, the issue is caused due to trying to access and modify the victim character's animation settings after the character has already left the game, making or nil. To solve this problem, you need to ensure that these objects are valid before you attempt to access them.