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

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

Asked by 8 years ago

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

Log in to vote
0
Answered by
M39a9am3R 3210 Moderation Voter Community Moderator
8 years ago

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.
Ad

Answer this question