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

How do I make invisible players visible upon death?

Asked by 7 years ago

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

Log in to vote
0
Answered by 7 years ago
Edited 7 years ago
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? ;)

0
Sorry but it gave me an error: W003: Global 'PlayerDied' is only used in an enclosing function; consider changing it to local gianthax2 0 — 7y
0
Oh gosh, I made a typo. :conenct(playerDied) should be :connect(playerDied) Stormersoul 0 — 7y
0
It's not that, I fixed that myself, The first playerDied is underlined in blue, and it says what I put up there. gianthax2 0 — 7y
Ad
Log in to vote
0
Answered by 7 years ago

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

Answer this question