So i made this MouseButton1Click (GUI) script.
local Player = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() local model = game.Workspace[Player.Name] local children = model:GetDescendants() for i , v in pairs(children) do if v:IsA("BasePart") then v.Color = Color3.new(0.235294, 0.898039, 1) game.Workspace[Player.name].Chest1.Eye.Color = Color3.new(0, 0, 0) game.Workspace[Player.name].Chest1.FaceMask1.Color = Color3.new(1, 1, 1) game.Workspace[Player.name].Chest1.FaceMask2.Color = Color3.new(1, 1, 1) end end end)
And it would change the character's color, but it would show up THE CHANGES for the player that clicked the button.
Since roblox added FE, local scripts doesn't affect the server. What you need to do is create a remote event (You can place it inside the script) and then fire it on the MouseButtonClick1 function.
--LOCAL SCRIPT local Player = game.Players.LocalPlayer local RemoteEvent = script.RemoteEvent -- Assuming you placed it inside the script script.Parent.MouseButton1Click:Connect(function() RemoteEvent:FireServer() end)
Okay, now you have triggered the Remote Event and you want the character changes to happen on the server, to do that you need to run the code in a script. You can put it wherever you want, but to keep things organized I would put it in the same Parent or inside the local script
--SCRIPT local RemoteEvent = script.Parent.RemoteEvent -- Assuming you placed the script inside the local script RemoteEvent.OnServerEvent:Connect(function(player) local model = player.Character for i, v in pairs(model:GetChildren()) do if v:IsA("BasePart") then v.Color = Color3.new(0.235294, 0.898039, 1) model.Chest1.Eye.Color = Color3.new(0, 0, 0) model.Chest1.FaceMask1.Color = Color3.new(1, 1, 1) model.Chest1.FaceMask2.Color = Color3.new(1, 1, 1) end end end)
If I have a typo I’m sorry, but that should give you an idea of how to use Remote Events