so i tried to FE this script
local player = game:GetService("Players").LocalPlayer local button = script.Parent button.Activated:Connect(function() local char = player.Character char.EyeColor.BrickColor = BrickColor.new(script.Parent.Color.Value) end)
and it turned out like this but the new code wont work... why??? | v
local player = script.Parent.Parent.Parent.Parent.Parent.Parent local button = script.Parent button.Activated:Connect(function() local char = player.Character char.ChestColor1.BrickColor = BrickColor.new(script.Parent.Color.Value) end)
I suggest you should read up on RemoteEvents, just because you change a LocalScript to Server, doesn't mean it will always work. I will provide links at the end.
Setting up:
Understanding FilterEnabled:
FilteringEnabled is a way to prevent exploiters replicating their client onto the server without the use of Events. Do keep in mind, as enabling it may prevent exploiters, it will also prevent any client replicating over, meaning you have to send information from Client to Server if you wish to replicate things through.
Understanding RemoteEvents: There are a lot of events in which can help you replicate over to server, but most common being RemoteEvents. Here you can send information from Client to Server to allow things to replicate over.
The fault in your code: You have tried using a ServerScript to activate something which is on the Client, this will not work and has to be through the client. This means will we have to use RemoteEvents to fire information over.
New code, explained:
Assuming you've done the setting up correctly, you can now start to place in your code.
LocalScript
local RS = game:GetService('ReplicatedStorage') local Player = game.Players.LocalPlayer local Button = script.Parent local ColorValue = Button:WaitForChild('Color') Button.MouseButton1Down:Connect(function() RS:WaitForChild('RemoteEvent'):FireServer(ColorValue.Value) -- WaitForChild prevents it from causing errors if you click the button before the remote is loaded in, but this will happen rarely but just incase. FireServer fires the remote to server, just like it implies. You are sending over your color value data. end)
ServerScript
local RS = game:GetService('ReplicatedStorage') local Remote = RS:WaitForChild('RemoteEvent') Remote.OnServerEvent = function(Player, ColorValue) -- Player is automatically fired over, the second parameter being your colorvalue you sent over local Character = Player.Character or Player.CharacterAdded:Wait() -- Find character or wait for it to load in. Character.ChestColor1.BrickColor = BrickColor.new(ColorValue) -- change the color end -- Finally, ending the function.
Summary:
You can learn more about RemoteEvents by clicking on the word link.
If you are still stuck or get any errors please feel free to add my Discord: Josh K#2740