Finding Local information from Server

Hi! I have been working on a character customization system and I’m trying to create a confirmation system to change the appearance. The issue I am faced with, however, is getting the server that information. I am using a value right now, that is the background color of the UI part selected. This color is the skin color, so the Color3 value is that color. However, it is created on a server. When “Confirm” is pressed, the parts change to black, since it is the base color of the value, meaning the server didn’t detect the change. How can I efficiently communicate between the two? Thanks!

This is the entire purpose of RemoteEvents - to communicate information between the client and the server. Am I misunderstanding?

I am aware, and I’m using them, but I need some help with parameters. The information is communicating, but the server can’t find the essential information since it is changed in the client. I need to use parameters or some way of communicating that through remoteevents so that it can find the changes. The client detects the UI getting touched, but the server can’t get any of the information that roots from it.

Can’t you simply pass the variables you need the server to know about through the RemoteEvent?

That’s what I need help with, I’m having trouble with the parameters, I’ve always had a hard time understanding the parameter portion.

The parameters are whatever you want, and as many as you want. The server will receive one extra parameter, which will be the first parameter, which is the player who’s client fired the event.

If you’re still confused, show us the code that’s causing you issues so we can see what exactly you’re doing wrong

In terms of the language, how can I make a parameter be equal to the location of an object. (I.E script.parent)?

That’s not referencing the location of an object, that’s referencing an object itself. you can just pass that as one argument and it will work just fine

Ohh! Thank you so much, going to test ASAP and will respond if error occurs.

I’m still kind of confused, here are the lines of code outlining the parameters.

script.Parent.MouseButton1Click:Connect(function()

confirm:FireServer(events:WaitForChild("skinTone").Value)

end)

game.Players.PlayerAdded:Connect(function(plr)

confirm.OnServerEvent:Connect(function(Tone)
for i, v in pairs(plr.Character:GetChildren()) do
if v.ClassName == “Part” then
v.Color = Color3.new(Tone) end
end
end)
end)

I’ve always had a lot of trouble with parameters, to this day I don’t understand how to use them. An explanation on how to do it with the language would really be appreciated!

I used parameters in it, but the parameter for finding the event still gets the base color since the value is only changed on the client. The change is invisible to the server.

Well your code looks very confusing but the immediate issue I see is that you’re not accounting for the “player” arguement that’s passed on the server side.

This is how they work

event:FireServer(Arg1, Arg2, Arg3, …)
event.OnServerEvent:connect(function(Player, Arg1, Arg2, Arg3, …) end)

So right now on the server side, instead of getting the arguement that you passed as the skin tone, you’re just getting the Player, you need to throw in a variable in front of “Tone” to take that argument so that you’re receiving the correct information

That’s working, but the color is coming out as black (the base color of color3 values). It’s because the color is changed only on the client, so the server only sees what’s changed on the server(nothing). I can’t change it because the information occurs only on the client, I can’t transfer it.

Here is what happens

local repStorage = game:GetService(“ReplicatedStorage”)
local events = repStorage:WaitForChild(“Customization”)
local confirm = events:WaitForChild(“Confirm”)

local function doTone(Tone)

confirm:FireServer(Tone)

end

script.Parent.MouseButton1Click:Connect(doTone(events:WaitForChild(“skinTone”).Value))

Then the server:

local repStorage = game:GetService(“ReplicatedStorage”)
local events = repStorage:WaitForChild(“Customization”)
local confirm = events:WaitForChild(“Confirm”)

confirm.OnServerEvent:Connect(function(player, Tone)
for i, v in pairs(player.Character:GetChildren()) do
if v.ClassName == “Part” then
v.Color = Color3.new(Tone) end
end
end)

This is my error: attempt to call a nil value

What data type is skinTone.Value? is that a number value? is it a color value?

Color3

Ok if it’s Color3, then you don’t need to do Color3.new(Tone), you can just use Tone

I changed that, but I’m still erroring.

The same error?

Before that line, put

print(Tone)

and when it runs, tell me what it’s outputting

(0,0,0) The base value of it

Also, the function is running automatically, am I calling it wrong here?

script.Parent.MouseButton1Click:Connect(doTone(events.skinTone.Value))

I’m not used to calling functions this way