Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

My death screen script appears in the studio but not in the game?

game.Players.LocalPlayer.Character:WaitForChild('Humanoid').Died:connect(function()
	script.Parent.Parent.Frame.Visible = true
end)

3 answers

✓ Accepted answer

When you join a game it will take a small amout of time until the character is created. This delay is not included in studio. We commonly use the following code to wait for the character:-

local localPlr = game:GetService('Players').LocalPlayer
local char = localPlr.Character or localPlr.CharacterAdded:Wait() -- if the character is nil ie not loaded wait intil the character is added and return the character model to the char variable

Putting it all together

local localPlr = game:GetService('Players').LocalPlayer
local char = localPlr.Character or localPlr.CharacterAdded:Wait()

char:WaitForChild('Humanoid').Died:Connect(function()
	script.Parent.Parent.Frame.Visible = true
end)

Note this should be a local script in the gui.

I hope this helps.

4 comments

0

Thx

0

np

0

Hey do you know any website or video to help me with scripts?

Use the transparency property instead of the visible property.

im sure this will work if not then ill fix it

script.Parent.Parent.Frame:WaitForChild()
game.Players.LocalPlayer.Character:WaitForChild('Humanoid').Died:connect(function()
    script.Parent.Parent.Frame.Visible = true
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.