I made a script that removes a player's face when pressing a GUI. The problem is that the face only removes a player's face on their own screen. Example: Player A presses "remove face" and the face is only shown as blank on their screen, everyone else in the game will still see Player A as having a face on their own screens.
Script:
function onClicked(hit)
game.Workspace.LocalPlayer.Character.Head.face.Texture = ""
end
script.Parent.MouseButton1Click:connect(onClicked)
Introduction & Understanding
The reasoning behind this issue is mainly due to FilteringEnabled. Before continuing, please learn more about this by watching this quick video covering a bit of FE, and some reading. It’s mandatory you gather a collective knowledge on this as it is an imposed requirement as of ROBLOX’s Experimental Mode update of early September 2017. It’s also quite interesting and can increase performance between both the Client and the Server.
FilteringEnabled prevents automatic communication of LocalScripts to ServerScripts, primarily to reduce the probability of exploitation. Though because of this, these Scripts have been ultimately divided into their proper relationships.
Meaning that any work related or directed towards these categories can only be achievable accordingly. Though loopholes can achieve some amount of work in its opposite.
Why is this an issue? The Server is responsible for replicating all actions from the Client to all other affiliated Clients. If this action is severed—which is our situation—all changes made on one end will not be properly replicated to everyone else’s
FilteringEnabled doesn’t fully cut off communication though, it only prevents automatic communication. You can learn how to gain manual connection between these Scripts with RemoteEvents
Going About Fixing Your Issue
To fix your problem, add a RemoteEvent
in ReplicatedStorage
and create a ServerScript
within ServerScriptService
. Then write the following:
--// ServerScript local ReplicatedStorage = game:GetService("ReplicatedStorage") local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent") function ChangeCharacterAppearance(Player) if not (Player) then return end local Character = Player.Character if (Character) then local Face = Character:FindFirstChild("Head").Face if (Face) then Face.Texture = "" end end end RemoteEvent.OnServerEvent:Connect(ChangeCharacterAppearance) --// LocalScript local ReplicatedStorage = game:GetService("ReplicatedStorage") local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent") local Button = script.Parent Button.MouseButton1Click:Connect(function() RemoteEvent:FireServer() end)
Lowercase Connect Was Deprecated
• Though this still works, it's preferred that all developers become accustomed to the renewed functions. Please use :Connect()
.
• Eperimental Mode | Lay-over video | Stackoverflow post | Remote Events |
Hope this helps! Or brings you into the world of FE, if so don’t forget to accept and upvote! Questions, like me to further interpret? Comment!