Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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!

1
Make use of the player parameter. 'player' is the client who fired the event. pidgey 548 — 4y
0
player.Character.Head etc Clasterboy 72 — 4y

1 answer

Log in to vote
0
Answered by
sleazel 1287 Moderation Voter
4 years ago

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)
0
Thanks! Mrmonkeyman120 65 — 4y
Ad

Answer this question