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

GUI Face Changer Button of Player not showing?

Asked by 3 years ago

HI! I want to change a players face using a GUI Button, but I want other players to see the face to but the face is not appearing. I'm Using a local script in a gui button in startergui.

Heres my script

` local btn = script.Parent local Pop2 = game.StarterGui.DressUp.Button1SS.POPSoundEffect1 local player = game.Players.LocalPlayer.character or game.Players.LocalPlayer.CharacterAdded:Wait() local isHovering = false

btn.MouseEnter:Connect(function()

isHovering = true

btn:TweenSize(UDim2.new(0.153, 0,0.089, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)

end)

btn.MouseLeave:Connect(function()

isHovering = false

btn:TweenSize(UDim2.new(0.126, 0,0.063, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)

end)

btn.MouseButton1Down:Connect(function()

btn:TweenSize(UDim2.new(0.122, 0,0.059, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)
Pop2:play()

player.humanoid.head.face:Destroy() -- Deletes Players Previous Face
player.humanoid.head.face.texture = "rbxassetid//4880835484" -- Adds New Face

end)

btn.MouseButton1Up:Connect(function()

if not isHovering then
    btn:TweenSize(UDim2.new(0.122, 0,0.059, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)
else
    btn:TweenSize(UDim2.new(0.126, 0,0.063, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)
end

end) `

0
Use RemoteEvents OhManXDXD 445 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

You're using a localscript to do this, so the face change only shows on the client side. This is because of filtering enabled, which has been explained in the past https://scriptinghelpers.org/questions/47956/what-is-filtering-enabled#:~:text=Filtering%20Enabled%20is%20a%20form,make%20changes%20to%20the%20game.

To fix this, all you have to do is set up a remote event in replicated storage, call the event from the client, and receive it on the server. This will allow you to change the player's face on the server, which allows everyone to see it.

Example server script:

remoteEvent.OnServerEvent:Connect(function(player)
    player.humanoid.head.face:Destroy()
    player.humanoid.head.face.texture = "rbxassetid//4880835484"
end)

Now instead of changing the player's face in the localscript you just call the remote event:

btn:TweenSize(UDim2.new(0.122, 0,0.059, 0), Enum.EasingDirection.InOut, Enum.EasingStyle.Quint, 0.2, true)
Pop2:play()
remoteEvent:FireServer()

More information about remote events can be found here: https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events

Ad

Answer this question