Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do I copy a gui into the playergui in Filtering Enabled?

Hey guys, I'm running into an issue where I want to copy a gui into a player. I have filtering enabled on, and it does not work. But it does work with filtering enabled off.

The following code is in a serverscript:

game.Workspace.FilteringEnabled = false
game.ReplicatedStorage.PrisonTimeRemaining:Clone().Parent = player.PlayerGui
game.Workspace.FilteringEnabled = true

That is my really sketchy, hacky idea of a workaround. No idea if it works. Is there a better way to do this?

I assume it would have to be done using remote events, but I have no idea how to tackle this logically.

Thanks!

1 answer

##Problem

You're trying to change the FilteringEnabled Property in game and Clone objects to PlayerGui with a server script.


##Solution

The FilteringEnabled property is not able to be enabled or disabled in game. The reason for this is for security and compatibility measures, security being the exploitability of the game while compatibility continues to ensure the game is functioning properly.

What FilteringEnabled does is stops the client from making changes to the server, as well as the server from making changes to complete client oriented objects such as the PlayerGui. With this said, your script would not work in a Server Script since the server is acting to clone an object into PlayerGui. To fix this problem, you simply just have to use a LocalScript.

In order to have the client communicate to the server, or vice versa, I would recommend you look into RemoteEvents and RemoteFunctions.


##Final Script

####Note: This must be in a LocalScript if FilteringEnabled is set to true.

game.ReplicatedStorage.PrisonTimeRemaining:Clone().Parent = player.PlayerGui

######Hopefully this answer helped, if so hit the upvote button. If it answered your question do not forget to hit the upvote button. Have any questions, feel free to comment below.

This discussion is preserved as it was. New answers, comments, and votes are closed.