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

How do I make invisible players visible upon death?

I created a shooter called Invisible Targets, and so far most of it works, the catch of the game is that everyone is invisible basically I decided to create a cosmetic detail / feedback that on death, the already invisible player becomes visible.

This was the code I created but I can't seem to understand how to make things work

larm = script.Parent:findFirstChild("Left Arm") 
rarm = script.Parent:findFirstChild("Right Arm") 
head = script.Parent:findFirstChild("Head") 
torso = script.Parent:findFirstChild("Torso") 
lleg = script.Parent:findFirstChild("Left Leg") 
rleg = script.Parent:findFirstChild("Right Leg") 


function OnDeath()  
	
	print("test")
	wait(.000001)

	larm.Transparency = 0 
	rarm.Transparency = 0 
	head.Transparency = 0 
	torso.Transparency = 0  
	lleg.Transparency = 0 
	rleg.Transparency = 0 
end 



2 answers

local plr = game.Players.LocalPlayer
local chr = plr.Character

function grabPlayer(p)
	function playerDied()
		local chrParts = chr:GetChildren()
		for i, v in pairs(chrParts) do
			if v:IsA("Part") then
				v.Transparency = 0
			end
		end
	end
	chr.Humanoid.Died:connect(playerDied)
end

game.Players.PlayerAdded:connect(grabPlayer)

Did I do this right? ;)

3 comments

0

Sorry but it gave me an error: W003: Global 'PlayerDied' is only used in an enclosing function; consider changing it to local

0

Oh gosh, I made a typo. :conenct(playerDied) should be :connect(playerDied)

0

It's not that, I fixed that myself, The first playerDied is underlined in blue, and it says what I put up there.

Well, I solved my problem by grabbing and editing parts of a ragdoll script, thanks anyways dude

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