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

Can someone turn this script into a fade away, before respawn like script?

Asked by 10 years ago

Can somebody turn this script into a script, where a player fades away transparently when they die, before they respawn??

game.Players.PlayerAdded:connect(function(player)

player.CharacterAdded:connect(function(character)

character:WaitForChild("Humanoid").Died:connect(function()

print (player.Name .. " has died...")
end)
end)
end)

2 answers

Log in to vote
0
Answered by
Hybric 271 Moderation Voter
10 years ago

Make a script inside StarterGui

Put this inside script:

while true do
wait(0.01)
if script.Parent.Parent.Character.Humanoid.Health <= 0 then
repeat
wait(0.1)
local x = 0
x = x +0.01
script.Parent.Parent.Character.Head.Transparency = x
script.Parent.Parent.Character.Torso.Transparency = x
script.Parent.Parent.Character["Left Leg"].Transparency = x
script.Parent.Parent.Character["Right Leg"].Transparency = x
script.Parent.Parent.Character["Left Arm"].Transparency = x
script.Parent.Parent.Character["Right Arm"].Transparency = x
until
script.Parent.Parent.Character["Left Leg".]Transparency >= 1
end
wait(0.1)
end

Then make a script in Workspace

Put this in the text:

function OnEntered(Player)
    while Player.Character == nil do
        wait()
    end
    wait(1)
    Player.Changed:connect(function(Property)
        if Property == "Character" then
            if Player.Character then
                local Mods = script:GetChildren()
                for X = 1, # Mods do
                    if Mods[X].className == "Script" or Mods[X].className == "LocalScript" then
                        local S = Mods[X]:Clone()
                        S.Disabled = false
                        S.Parent = Player.Character
                    end
                end
            end
        end
    end)
    local Mods = script:GetChildren()
    for X = 1, # Mods do
        if Mods[X].className == "Script" or Mods[X].className == "LocalScript" then
            local S = Mods[X]:Clone()
            S.Disabled = false
            S.Parent = Player.Character
        end
    end
end
game.Players.ChildAdded:connect(OnEntered)

THEN INSERT A SCRIPT INSIDE THE SCRIPT YOU PUT IN WORKSPACE

MAKE THE SCRIPT THAT IS INSIDE THE SCRIPT IN WORKSPACE's TEXT:

Character = script.Parent
Humanoid = Character.Humanoid
Torso = Character.Torso

function OnDeath()
    print("Death")
    Humanoid.Parent = nil
    if Torso then
        local Head = Character:FindFirstChild("Head")
        if Head then
            local Neck = Instance.new("Weld")
            Neck.Name = "Neck"
            Neck.Part0 = Torso
            Neck.Part1 = Head
            Neck.C0 = CFrame.new(0, 1.5, 0)
            Neck.C1 = CFrame.new()
            Neck.Parent = Torso
        end
        local Limb = Character:FindFirstChild("Right Arm")
        if Limb then

            Limb.CFrame = Torso.CFrame * CFrame.new(1.5, 0, 0)
            local Joint = Instance.new("Glue")
            Joint.Name = "RightShoulder"
            Joint.Part0 = Torso
            Joint.Part1 = Limb
            Joint.C0 = CFrame.new(1.5, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
            Joint.C1 = CFrame.new(-0, 0.5, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
            Joint.Parent = Torso

            local B = Instance.new("Part")
            B.TopSurface = 0
            B.BottomSurface = 0
            B.formFactor = "Symmetric"
            B.Size = Vector3.new(1, 1, 1)
            B.Transparency = 1
            B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
            B.Parent = Character
            local W = Instance.new("Weld")
            W.Part0 = Limb
            W.Part1 = B
            W.C0 = CFrame.new(0, -0.5, 0)
            W.Parent = Limb

        end
        local Limb = Character:FindFirstChild("Left Arm")
        if Limb then

            Limb.CFrame = Torso.CFrame * CFrame.new(-1.5, 0, 0)
            local Joint = Instance.new("Glue")
            Joint.Name = "LeftShoulder"
            Joint.Part0 = Torso
            Joint.Part1 = Limb
            Joint.C0 = CFrame.new(-1.5, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
            Joint.C1 = CFrame.new(0, 0.5, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
            Joint.Parent = Torso

            local B = Instance.new("Part")
            B.TopSurface = 0
            B.BottomSurface = 0
            B.formFactor = "Symmetric"
            B.Size = Vector3.new(1, 1, 1)
            B.Transparency = 1
            B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
            B.Parent = Character
            local W = Instance.new("Weld")
            W.Part0 = Limb
            W.Part1 = B
            W.C0 = CFrame.new(0, -0.5, 0)
            W.Parent = Limb

        end
        local Limb = Character:FindFirstChild("Right Leg")
        if Limb then

            Limb.CFrame = Torso.CFrame * CFrame.new(0.5, -2, 0)
            local Joint = Instance.new("Glue")
            Joint.Name = "RightHip"
            Joint.Part0 = Torso
            Joint.Part1 = Limb
            Joint.C0 = CFrame.new(0.5, -1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
            Joint.C1 = CFrame.new(0, 1, 0, 0, 0, 1, 0, 1, 0, -1, -0, -0)
            Joint.Parent = Torso

            local B = Instance.new("Part")
            B.TopSurface = 0
            B.BottomSurface = 0
            B.formFactor = "Symmetric"
            B.Size = Vector3.new(1, 1, 1)
            B.Transparency = 1
            B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
            B.Parent = Character
            local W = Instance.new("Weld")
            W.Part0 = Limb
            W.Part1 = B
            W.C0 = CFrame.new(0, -0.5, 0)
            W.Parent = Limb

        end
        local Limb = Character:FindFirstChild("Left Leg")
        if Limb then

            Limb.CFrame = Torso.CFrame * CFrame.new(-0.5, -2, 0)
            local Joint = Instance.new("Glue")
            Joint.Name = "LeftHip"
            Joint.Part0 = Torso
            Joint.Part1 = Limb
            Joint.C0 = CFrame.new(-0.5, -1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
            Joint.C1 = CFrame.new(-0, 1, 0, -0, -0, -1, 0, 1, 0, 1, 0, 0)
            Joint.Parent = Torso

            local B = Instance.new("Part")
            B.TopSurface = 0
            B.BottomSurface = 0
            B.formFactor = "Symmetric"
            B.Size = Vector3.new(1, 1, 1)
            B.Transparency = 1
            B.CFrame = Limb.CFrame * CFrame.new(0, -0.5, 0)
            B.Parent = Character
            local W = Instance.new("Weld")
            W.Part0 = Limb
            W.Part1 = B
            W.C0 = CFrame.new(0, -0.5, 0)
            W.Parent = Limb

        end
        --[
        local Bar = Instance.new("Part")
        Bar.TopSurface = 0
        Bar.BottomSurface = 0
        Bar.formFactor = "Symmetric"
        Bar.Size = Vector3.new(1, 1, 1)
        Bar.Transparency = 1
        Bar.CFrame = Torso.CFrame * CFrame.new(0, 0.5, 0)
        Bar.Parent = Character
        local Weld = Instance.new("Weld")
        Weld.Part0 = Torso
        Weld.Part1 = Bar
        Weld.C0 = CFrame.new(0, 0.5, 0)
        Weld.Parent = Torso
        --]]
    end
end

Humanoid.Died:connect(OnDeath)

Ad
Log in to vote
0
Answered by 10 years ago

Heres how I would do it:

  1. Connect a method to the Died Event of Humanoid

http://wiki.roblox.com/index.php?title=Died

  1. When it dies, anchor all the body parts and the handles in all their hats.

  2. Use a for loop to progressively increment their transparency.

  3. When Transparency reaches 1, you can wait for the char to respawn OR

Use LoadCharacter to respawn the guy.

Answer this question