Face changes only seen by local player

I’ve created a button GUI that gives you a specific face when you press it, but for some reason this change is only noticeable by the local player who pressed it, for instance if two players are in a server and player 1 changes his face, player 2 will always see the basic smile face but it will work correctly on player 1’s end. I don’t know how to fix this…

player = game.Players.LocalPlayer



local function onButtonActivated()
	if toggled == false then
		button.BackgroundColor3 = Color3.fromRGB( 170 , 255 , 127 )
		toggled = true
        player.Character.Head.face.Texture = "rbxassetid://22626010"
       
	end
end
 
script.Parent.Activated:Connect(onButtonActivated)

This script is local, this is why, use a remote event.

1 Like

This is because you are doing this on the client with Filtering Enabled on, meaning anything on the client isn’t replicated to any other clients.

If you would like this to be done on everyone’s screen, you’ll need to use a remote event.

To find information on Remote Events and FE, here is a useful page that can help you understand. Here.

Here I created this for you. Youll need to put the server script in the ServerScriptService and the local script in the gui you made. Also make a remote event and name it ChangeFace and put it in replicatedstorage.

player = game.Players.LocalPlayer



local function onButtonActivated()
game.ReplicatedStorage.ChangeFace:FireServer()
 
script.Parent.Activated:Connect(onButtonActivated)

SERVER:

game.ReplicatedStorage.ChangeFace.OnServerEvent:Connect(function(player)
	if toggled == false then
		button.BackgroundColor3 = Color3.fromRGB( 170 , 255 , 127 )
		toggled = true
        player.Character.Head.face.Texture = "rbxassetid://22626010"
       
	end
end

This is not tested so let me know if you have any problems. All you should have to do is add the "end"s in both scripts. Also if it does work, mark it as the solution :slight_smile:

4 Likes

It indeed works, thanks for the help.

1 Like