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

Keep GUI on players screen after dieing?

Asked by
Nickoakz 231 Moderation Voter
8 years ago

I do not want all GUI's to stay on the user's screen after they respawn.

Only a specific one and that one only.

It's possible by certain admin commands, I just don't know how since source code is hidden behind the module.

So far, I found the admin commands http://www.roblox.com/games/176003675/Kohls-Admin-Testing-Place

Joining the game and trying to make the gui go away won't work, and inserting the admin commands into a game, and the game still having game.StarterGui.ResetGuisOnRespawn is still false, the GUI's still stay on screen..

So far, I have came up with this..

if script.Parent and script.Parent:findFirstChild("Locked")==nil and script.Parent.ClassName=="ScreenGui" then
    function UnArchive(p)
        pcall(function()
            p.Archivable=false;
        end)
        pcall(function()
            for i,v in ipairs(p:GetChildren()) do
                UnArchive(v)
            end
        end)
    end
    function TransferAll(mainlocation,item)
        pcall(function()
            print(item.Name.." : "..item:getFullName())
            item.Parent=mainlocation
        end)
        pcall(function()
            for i,v in ipairs(item:GetChildren()) do
            TransferAll(item,v)
            end
        end)
    end
    local lock=Instance.new("StringValue",script.Parent)
    lock.Name="Locked"
    local gui=script.Parent
    UnArchive(gui)
    script.Parent=nil
    local me=script.Parent
    function AlwaysChecking()
        for a=1,25 do
            print("Checking "..gui:GetFullName())
            if gui.Parent~=game.Players.LocalPlayer.PlayerGui then
                TransferAll(game.Players.LocalPlayer.PlayerGui,gui)
                --gui.Parent=game.Players.LocalPlayer.PlayerGui
            end
            wait(.1)
        end
    end
    gui.Changed:connect(function()
        print("Fired")
        AlwaysChecking()
    end)
    gui.AncestryChanged:connect(function()
        print("Fired2")
        AlwaysChecking()
    end)
end

A nasty loop to make sure it stays in it's original parent, and then when I do want to remove it, simply disable this script, and delete the GUI. However, I know there's a simpler option, and I would still like help. PS. Thanks for the downvote whoever you are.

0
If you don't have access to source code, it is difficult to give a solution. Attempting to blindly modify something may have adverse side effects, potentially even causing the program to break. BlackJPI 2658 — 8y
0
That being said, you could use the .Died event of Humanoid to clone the desired GUI into the PlayerGui upon respawn. BlackJPI 2658 — 8y
0
If I had a script monitor where it's parent was, could I just reparent it to the players gui? Nickoakz 231 — 8y
1
In the Properties of StarterGui there's a property called 'ResetPlayerGuiOnSpawn', set it to false, idk about the next part. RoyMer 301 — 8y
0
I did say that this setting has to be on in the top, for all other guis to remove themselves. Nickoakz 231 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago

Simply keep the transparency of the Frame of your GUI or the TextLabel or whatever it may be you're using to 0. That will stay. Edit this however you need:

local gui1 = game.StarterGUI.ScreenGUI1.Frame.Texbutton  -- Gui that doesn't stay on screen
local gui2 = game.StarterGUI.ScreenGUI2.Frame.Textbutton -- Gui that doesn't stay on screen
local gui2 = game.StarterGUI.ScreenGUI2.Frame.Textbutton -- Gui that stays on screen

game.Players.PlayerAdded:connect(function(player)
    gui1.Transparency = 0
    gui2.Transparency = 0
    gui3.Transparency = 0
end)

if player.Humanoid.Health == 0 then
    gui1.Transparency = 1
    gui2.Transparency = 1
    gui3.Transparency = 0
end

If this was not what you're looking for please contact me and I can help you out further.

0
This simply makes the gui transparent and does not keep the GUI on the screen. I can't put the GUI into StarterGui or enable the RemoveGuisOnReload option. Nickoakz 231 — 8y
Ad
Log in to vote
0
Answered by 8 years ago

There is an option in ROBLOX Studio that still keeps the player's GUI on death. In ROBLOX Studio, click StarterGUI and find the option that says "ResetPlayerGuiOnSpawn". Disable it and the GUI's will still stay on screen. No code needed for that. Here's a screenshot

0
I understand this, but the game cannot have this option on as I'm also developing a type of admin commands. Nickoakz 231 — 8y
0
If it is for admins only then it fairly easy to hide it from non-admins. All you got to do is check their names and destroy it if they are not admins CMVProduction 25 — 8y

Answer this question