So i put in a code but all it does is takes away the players face
I have a ServerScript in work space : local ReplicatedStorage = game:GetService("ReplicatedStorage") game.ReplicatedStorage.RemoteFaceTest1.OnServerEvent:Connect(function(player, facechange) player.Character.Head.face.Texture = facechange end)
And here is my script for the button : local ReplicatedStorage = game:GetService("ReplicatedStorage") script.Parent.MouseButton1Click:Connect(function() game.ReplicatedStorage.RemoteFaceTest1:FireServer("rbxassetid://12145366") end)
I also have a remote event in replicated storage. I dont see any errors in the code can anyone help?
Hello!
So, the method you are using to change the player's face won't work. I re-wrote your script using HumanoidDescription and it works completely fine.
Here is the code:
ServerScript
01 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
02 | local remoteFaceTest_ 1 = ReplicatedStorage:WaitForChild( 'RemoteFaceTest1' ) |
03 |
04 | remoteFaceTest_ 1. OnServerEvent:Connect( function (player, facechange) |
05 | local humanoid = player.Character and player.Character:FindFirstChild( "Humanoid" ) |
06 | if humanoid then |
07 | local descriptionClone = humanoid:GetAppliedDescription() |
08 | descriptionClone.Face = facechange |
09 | humanoid:ApplyDescription(descriptionClone) |
10 | end |
11 | end ) |
LocalScript
1 | local ReplicatedStorage = game:GetService( "ReplicatedStorage" ) |
2 | local remoteFaceTest 1 = ReplicatedStorage:WaitForChild( 'RemoteFaceTest1' ) |
3 |
4 | script.Parent.MouseButton 1 Click:Connect( function () |
5 | remoteFaceTest 1 :FireServer( 12145366 ) |
6 | end ) |
I hope it works for you! If you need any questions, feel free to reply to this answer.
Sincerely, Ziruken