Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

I'm making a face changer with FE enabled using a RemoteEvent that won't work, any help?

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!

2 comments

1

Make use of the player parameter. 'player' is the client who fired the event.

0

player.Character.Head etc

1 answer

✓ Accepted answer

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)

1 comment

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.