Trying to make a server-sided face changer

I’m trying to make a gui that allows players to change their faces and everyone else in the server can see it, But i guess i did something wrong.

Breakdown of the script:
FaceEvent (RemoteEvent)
Player (Getting Local Player)
Character (Getting The Local Players Character)
Gui (Getting The Gui)
Button (Getting The Guis Button)

L_Eye (Getting The Left Eye)
R_Eye (Getting The Right Eye)
Mouth (Getting The Mouth)
Eyebrow (Getting The Eyebrow)
(Just breaking this done just so it more understandable i guess.)

--// Basic Locals
local FaceEvent = game:GetService("ReplicatedStorage").FaceEvent
local Player = game.Players.LocalPlayer
local Character = Player.Character:WaitForChild("Face")
local Gui = script.Parent.Parent
local Button = Gui.TextButton
--// Gui Parts
local L_Eye = Gui.ImageLabel.L_Eye
local R_Eye = Gui.ImageLabel.R_Eye
local Mouth = Gui.ImageLabel.Mouth
local Eyebrow = Gui.ImageLabel.Eyebrow

Button.MouseButton1Click:Connect(function(Face)
	Character.L_Eye.Texture = L_Eye.Image
	Character.R_Eye.Texture = R_Eye.Image
	Character.Mouth.Texture = Mouth.Image
	Character.Eyebrow.Texture = Eyebrow.Image
	FaceEvent:FireServer(Face)

end)

Problem:
https://gyazo.com/c17ecc34a0baf4dc16f462132b0aa26a

The Face parameter that you have in

Button.MouseButton1Click:Connect(function(Face)

Doesn’t exist, it’s not a thing.
Just group all the separate texture ids into a table and send the table through the face event and let the server script break it down and apply those texture ids. Make sure you send it in as an ID, and not the actual texture, since the server doesn’t know it exists and it will just be nil to the server.

Uhm, how would i do this? i don’t usually mess with tables.

Client:

--// Basic Locals
local FaceEvent = game:GetService("ReplicatedStorage").FaceEvent
local Player = game.Players.LocalPlayer
local Character = Player.Character:WaitForChild("Face")
local Gui = script.Parent.Parent
local Button = Gui.TextButton
--// Gui Parts
local L_Eye = Gui.ImageLabel.L_Eye
local R_Eye = Gui.ImageLabel.R_Eye
local Mouth = Gui.ImageLabel.Mouth
local Eyebrow = Gui.ImageLabel.Eyebrow

Button.MouseButton1Click:Connect(function()
	Character.L_Eye.Texture = L_Eye.Image
	Character.R_Eye.Texture = R_Eye.Image
	Character.Mouth.Texture = Mouth.Image
	Character.Eyebrow.Texture = Eyebrow.Image
	
	local ID_Table = {Character.L_Eye.Texture, Character.R_Eye.Texture, Character.Mouth.Texture, Character.Eyebrow.Texture}
	FaceEvent:FireServer(ID_Table)
end)

Server:

local FaceEvent = game:GetService("ReplicatedStorage").FaceEvent

FaceEvent.OnServerEvent:Connect(function(Plr, ID_Table)
	local Character = Plr.Character
	local Face = Character:WaitForChild("Face")
	
	Face.L_Eye.Texture = ID_Table[1]
	Face.R_Eye.Texture = ID_Table[2]
	Face.Mouth.Texture = ID_Table[3]
	Face.Eyebrow.Texture = ID_Table[4]
end)

If it errors show me error so I can fix, can’t guarantee success first try because I don’t have your variables.

1 Like