Ok, so I'm creating a customize option for my game, and the game involves multiple people. I know I should use a RemoteEvent so I put a RemoteEvent in ReplicatedStorage and named it "Remote". I then put a local script inside of the GUI button that would be pressed to fire the RemoteEvent so I put:
script.Parent.MouseButton1Click:Connect(function() game.ReplicatedStorage.Remote:FireServer("rbxassetid//7317765")--This is the face ID I want to send to the ServerScript end)
I then put a ServerScript inside of Workspace and named it "EventScript" This is where I couldn't make it work:
game.ReplicatedStorage.Remote.OnServerEvent:Connect(function(player, facechange) game.Player.LocalPlayer.Character.Head.face.Texture = facechange end)
I know I can't access game.Player.LocalPlayer.Character
inside of a ServerScript, so what do I do?`Any help is appreciated, thanks!
You cannot use LocalPlayer property in the server script. Your server script should look like this:
game.ReplicatedStorage.Remote.OnServerEvent:Connect(function(player, facechange) player.character.Head.face.Texture = facechange end)