I have a GUI button that when clicked, triggers a remote event to the server to change the color of the client's head on the avatar. Here is what is written in a local script:
local btn = script.Parent local ReplicatedStorage = game:GetService("ReplicatedStorage") local OvercookedEvent = ReplicatedStorage:WaitForChild("OvercookedEvent") local plr = game.Players.LocalPlayer btn.MouseButton1Click:Connect(function(plr) btn.Text = "EQUIPPED" btn.Parent.DefaultButton.Text = "EQUIP" btn.Parent.Undercookedbutton.Text = "EQUIP" btn.Parent.SweetPotatoButton.Text = "EQUIP" OvercookedEvent:FireServer(plr) end)
Here is what is in a server script:
local btn = game.StarterGui.GameGUI.FriesMenu.OvercookedButton local ReplicatedStorage = game:GetService("ReplicatedStorage") local OvercookedEvent = ReplicatedStorage:WaitForChild("OvercookedEvent") OvercookedEvent.OnServerEvent:Connect(function(plr) local Character = plr.Character local bodyColors = Character:WaitForChild("Body Colors") bodyColors.HeadColor = BrickColor.new("Alder") end)
This works, but it only does this once, meaning that when I click the GUI button, my avatar's head becomes alder, but then after I switch the head color back to normal using another button my game, this button no longer colors the head alder when clicked after the first time.
I've fixed this myself. The issue was with other scripts that interacted with this situation. :)