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

How to convert a function without compromising it's properties?

Asked by 7 years ago

For the past few days, I've been converting my places to Filtering Enabled(FE). I think I got the grasp of FE, however I've ran into a serious problem. All of my Guis that are used in my game will not work unless cloned in a specified format. At the moment, I have a Script that clones my Guis and such into the Player's PlayerGui. This script however, will not clone again on the player's respawn.

This is the original line of code:

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(char)
        for _,v in pairs(script.StarterGui:GetChildren()) do
            v:Clone().Parent = plr.PlayerGui                  
        end
    end)
end)

I've tried changing a few things in another script and this is what it looks like.

game.Players.PlayerAdded:connect(function(plr)
    plr.Changed:connect(function(property)
        for _,v in pairs(script.StarterGui:GetChildren()) do
            v:Clone().Parent = plr.PlayerGui                 
        end
    end)
end)

The changes to the script allowed for the cloning of the Guis, but the buttons not working in the end. I would like to change the original script to account for respawns. Please leave a comment or an answer. Thank you for taking the time to read this.

0
IS this really necessary? The point of the StarterGui is to put the children of it inside each player when they join.... User#9949 0 — 7y
0
It is, since when putting it in straight as a ScreenGui in StarterGui, many problems occur. Either the scripts won't recognize anything around them, or they will not work at all. This script allows those buttons to work. Ninjaruaz 22 — 7y

Answer this question