I’m trying to make parts of a tool go transparent when the player dies using the Humanoid.Died script signal but whenever the game loads it gives me an error “Players.TheUserThatIsTheUser.Backpack.Knife.ViewmodelConfigurations:22: attempt to index nil with ‘Humanoid’”
Here is my code for this:
player.Character.Humanoid.Died:Connect(function()
rightarm.Transparency = 1
leftarm.Transparency = 1
end)
For context, player = game.Players.LocalPlayer and right and left arm are parts.
I have also tried making a while true do that will constantly check if the players Humanoid Health value is 0 with an if statement to no avail.
Sorry if this looks a bit sloppy it’s my first time making a topic.
Sometimes it takes time and needs to wait until it is found.
Try:
local Players =game:GetService("Players")
local Player = Players.LocalPlayer
local Char = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Char:WaitForChild("Humanoid")