Character reset help

Hi guys, just a quick question, what function would we use if a player resets the character?
We are trying to move from a gui on screen to despawn to the default roblox one again but we arent able to figure out some stuff like our music playing again when you enter the main menu.
This is the old script inside the TextButton:

script.Parent.MouseButton1Click:Connect(function()
    game.Players.LocalPlayer.Character.Humanoid.Health = 0
end)



script.Parent.MouseButton1Click:Connect(function()
    game.Workspace.Music.hangup.Volume = 0.5
    game.Workspace.Music.hangup.Looped = true

    game.Workspace.Music.GoAgain.Volume = 0.5
    game.Workspace.Music.GoAgain.Looped = true

    game.Workspace.Music.NiceSummer.Volume = 0.5
    game.Workspace.Music.NiceSummer.Looped = true

    game.Workspace.Music.SideStep.Volume = 0.5
    game.Workspace.Music.SideStep.Looped = true

    game.Workspace.Music.SunnyDay.Volume = 0.5
    game.Workspace.Music.SunnyDay.Looped = true

    game.Workspace.Music.TheInfamySmphony.Volume = 0.5
    game.Workspace.Music.TheInfamySmphony.Looped = true

    game.Workspace.Music.WhenUComingBack.Volume = 0.5
    game.Workspace.Music.WhenUComingBack.Looped = true

    game.Workspace.Music.WonderfulDay.Volume = 0.5
    game.Workspace.Music.WonderfulDay.Looped = true

    game.StarterGui.reset.TextButton.Visible = false
    game.StarterGui.Signallerinfo.Frame.Visible = false
end)

Thanks in advance!

Do you mean when player dies? if so:

game.Players.LocalPlayer.Character.Humanoid.Died:Connect(function()
1 Like

If the player dies does is it with the same function as the player resetting character?

As long as humanoid health is 0, yes.

1 Like

Something that might help: Humanoid | Roblox Creator Documentation

1 Like

Unfortunately, i tried both but they didn’t work (I used the link to the section in the website too and tested it)

Another thing, there’s no reason to list through each of your sounds when adjusting the volume. Instead, try

for i, music in pairs(game.Workspace.Music:GetChildren()) do

music.Volume = 0.5
music.Looped = false

end

This function only fires on server script so that’s maybe why it doesn’t work.

1 Like

thanks for the tip, ill use it!