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

Help with filtering enabled? [closed]

Asked by 9 years ago

Hey everyone, I am attempting to reduce exploiters in my game by using filtering enabled, one issue I have found is that startergui wont copy over to playergui (I assume the same happens with starterpack although I can think of an easy workaround for that). I attempted to do this:

player.CharacterAdded:connect(function(character)
    for i,v in pairs(game:GetService("StarterGui"):GetChildren()) do
        v:clone().Parent = player:WaitForChild("PlayerGui")
    end
end)

with no success, any ideas?

1
Why user CharacterAdded when you can use PlayerAdded? Try PlayerAdded. Also, anything in the output? SlickPwner 534 — 9y
0
Nothing crackabottle123 110 — 9y
0
Is that your entire script? SanityMan 239 — 9y
0
nope crackabottle123 110 — 9y
View all comments (4 more)
2
Post the uppermost function that this is nested inside of. FilteringEnabled doesn't stop Server to Client replication, only Client to Server, so the StarterGui *should* be being copied over. adark 5487 — 9y
0
Sorry, tried the playeradded thing and it worked, for whatever reason I assumed that the playergui replicated with every character addition, sorry for not commenting earlier. crackabottle123 110 — 9y
1
Yeah, for future reference, every time a Player's Character is added, unless teh ResetPlayerGuiOnSpawn property is ticked, they will get a copy of the *current* contents of StarterGui added to their PlayerGui. If that property is unticked, the old contents will be removed and then the startergui contents will be added. adark 5487 — 9y
0
cheers crackabottle123 110 — 9y

Locked by adark, Shawnyg, and SanityMan

This question has been locked to preserve its current state and prevent spam and unwanted comments and answers.

Why was this question closed?

1 answer

Log in to vote
-1
Answered by 9 years ago

I had the very same problem so I am using this script which fixes the problem:- This script is in ServerScriptService and my gui is in the workspace

function onHumanoidDied(property, plr)

    plrGui = plr.PlayerGui:FindFirstChild("ScreenGui")

    if plr~= nil and plrGui~=nil then   
        plr.PlayerGui.ScreenGui:Destroy()
    end

end

function onPlayerRespawn(property, plr)

        while plr and plr.Parent do
                if plr.Character then break end
            wait(1)
        end

        if not (plr and plr.Parent) then return end

   wait(1)
    if game.Workspace.FilteringEnabled then
        game.Workspace.FilteringEnabled = false
        wait(1)
        Workspace.ScreenGui:Clone().Parent = plr.PlayerGui
        game.Workspace.FilteringEnabled = true
    else
        game.Workspace.FilteringEnabled = true
    end

end

function onPlayerEntered(plr)

        while plr and plr.Parent do
            if plr.Character then break end
            wait(1)
                end
       if not (plr and plr.Parent) then return end

        wait(1)
        Workspace.ScreenGui:Clone().Parent = plr.PlayerGui

        plr.CharacterRemoving:connect(function(property) onHumanoidDied(property, plr) end)
        plr.CharacterAdded:connect(function(property) onPlayerRespawn(property, plr) end)

end
game.Players.PlayerAdded:connect(onPlayerEntered)
Ad