Hey, I’m trying to make a “other side” system on my game where when the Player dies a GUI pops up saying “Move on” or “Hold on” and if they press “Hold on” then they would be on the other side therefore their character would not be resetting, how would I achieve this?
Remove the character with Player:RemoveCharacter()
to avoid reset. If you want to respawn later then simply load a new character with similar function.
I’m talking about the death-related bit, so when the player resets/dies from low health then their character would not respawn and would stay there
To make if players dies show GUI:
ServerScript(ServerScriptService):
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(char)
local hum = char:WaitForChild("Humanoid")
hum.Died:Connect(function()
player.PlayerGui:FindFirstChild("YourGuiNameHere").YourFrameHere.Visible = true
wait(timeWantToWait)
-- player.PlayerGui:FindFirstChild("YourGuiNameHere").YourFrameHere.Visible = false
-- player:RemoveCharacter()
end)
end)
end)
My old system works similar to this although it did not work sadly.
I never tried out this but you could set Players.CharacterAutoLoads
to false
.
Could you provide reasoning as to why this may be occuring?
Basically, let me explain again.
When the Player dies, they have a chance to be resurrected if they choose the option, “Hold on”, if they do not they will die (reload character, which works). This has to happen WITHOUT cloning the character.
I’m sorry I meant to quote this instead. What exactly did your old script do?
Here’s my old script, which did not work exactly how I wanted it to (there was a lot of bugs)
wait()
local Humanoid = script.Parent:FindFirstChild("Humanoid")
if script.Parent:GetAttribute("Species") ~= "Mortal" then
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, false)
else
Humanoid:SetStateEnabled(Enum.HumanoidStateType.Dead, true)
end
Humanoid.HealthChanged:Connect(function(val)
if val <= 2 then
local Character = script.Parent
Character.Ragdoll.Activate.Value = true
print("Player has died!")
local Player = game:GetService("Players"):GetPlayerFromCharacter(Character)
for _, v in pairs(Player.PlayerGui.Core.Notifications.Otherside:GetChildren()) do
if v:IsA("TextLabel") then game:GetService("TweenService"):Create(v, TweenInfo.new(.5), {TextTransparency = 0}):Play() end
end
wait(2)
for _, v in pairs(Player.PlayerGui.Core.Notifications.Otherside:GetChildren()) do
if v:IsA("TextButton") then game:GetService("TweenService"):Create(v, TweenInfo.new(.5), {TextTransparency = 0}):Play() end
end
Player.PlayerGui.Core.Notifications.Otherside.Selected.Changed:Connect(function(string)
if string == "HoldOn" then
for _, v in pairs(Player.PlayerGui.Core.Notifications.Otherside:GetChildren()) do
if v:IsA("TextLabel") then game:GetService("TweenService"):Create(v, TweenInfo.new(.5), {TextTransparency = 1}):Play() end
end
wait(.9)
for _, v in pairs(Player.PlayerGui.Core.Notifications.Otherside:GetChildren()) do
if v:IsA("TextButton") then game:GetService("TweenService"):Create(v, TweenInfo.new(.5), {TextTransparency = 1}):Play() end
end
return
elseif string == "MoveOn" then
for _, v in pairs(Player.PlayerGui.Core.Notifications.Otherside:GetChildren()) do
if v:IsA("TextLabel") then game:GetService("TweenService"):Create(v, TweenInfo.new(.5), {TextTransparency = 1}):Play() end
end
wait(.9)
for _, v in pairs(Player.PlayerGui.Core.Notifications.Otherside:GetChildren()) do
if v:IsA("TextButton") then game:GetService("TweenService"):Create(v, TweenInfo.new(.5), {TextTransparency = 1}):Play() end
end
Player:LoadCharacter()
end
end)
end
end)
Is this value?
HealthChanged
HealthChanged is a Humanoid function which detects when the Player Health is changed.
Why don’t you use Humanoid.Died
function?
Because it doesn’t work when I do use it.
Is this a server script? or LocalScript?
It’s a server-script.
(characterss limkt)
Yes it is firing because the “Player has died” print is loading.
DId you set RespawnTime?
(char limits)
Yes, let me show you what the issue is currently.
https://gyazo.com/248b461367023bff23f5a5e2db79771f
The issue is, does the character load before the button is pressed?