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

Why isn't the character's head disappearing?

Asked by
Discern 1007 Moderation Voter
9 years ago

The player's head is supposed to disappear every time they spawn. I am getting an output. Here is my LocalScript inside StarterGui.

local player = game.Players.LocalPlayer
repeat wait() until player.Character
local character = player.Character
local head = character:WaitForChild("Head")

head.Transparency = 1
script:Destroy()

This is the output I am receiving:

18:12:11.087 - WaitForChild is not a valid member of Model

18:12:11.088 - Script 'Players.Player.PlayerGui.LocalScript', Line 4

18:12:11.088 - Stack End

All help is appreciated.

Thanks. :)

0
Try the "FindFirstChild" method instead of the "WaitForChild" method. Redbullusa 1580 — 9y
0
FindFirstChild is not a valid member of Model, Script 'Players.Player.PlayerGui.LocalScript', Line 4, Stack End Discern 1007 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

I copied your script into a Localscript in StarterGui, and It worked.

local player = game.Players.LocalPlayer
repeat wait() until player.Character
local character = player.Character
local head = character:WaitForChild("Head")
head.Transparency = 1
script:Destroy()

Tips -

You might want to remove the hats on the player if there are any You also might want to remove the face of the person since it still shows on an invisible head.

0
Really? That's weird. I get the output error, and in Explorer, the Head still has 0 Transparency. Discern 1007 — 9y
0
This could be because I'm always testing on "play solo", maybe it doesn't work on online mode like you are testing it on SpazzMan502 133 — 9y
0
I get the error on Play Solo AND Online (Developer Console says it). Discern 1007 — 9y
Ad
Log in to vote
0
Answered by
Relatch 550 Moderation Voter
9 years ago

Try adding a wait before it destroys the script. Because once the script runs, it's destroyed. If you don't know where to put it, i'll show you:

local player = game.Players.LocalPlayer
repeat wait() until player.Character
local character = player.Character
local head = character:WaitForChild("Head")

head.Transparency = 1
wait(1)
script:Destroy()
0
Same error. Same Output. Discern 1007 — 9y

Answer this question