Now I dont even know where what goes but sure I will try.
Also that wait is there because that was a while true do function, and I forgot to remove it.
Now I dont even know where what goes but sure I will try.
Also that wait is there because that was a while true do function, and I forgot to remove it.
if mode.Value == 5 then --Color
RemoteEvent.OnServerEvent(function(player, data)
print("The vaule is 5")
if target.Locked == false then
print("target is locked")
target.Color = Color3(data)
print(data)
end
end)
end
Ok so this is in a regular script.
And,
RemoteEvent:FireServer(player.PlayerGui.LoadoutGui.Loadout.SpawnMenu.Loadout.RGB.Text)
This is in a local script.
And also there is: local RemoteEvent = game.ReplicatedStorage:WaitForChild("Color")
in both scripts.
I honestly dont know what to say anymore, I mean you can just look at what mess I wrote and tell me that its wrong, or by any luck if it actually right.
Well by now I tried that and it didnt really work.
Do I need to replace the data with something?
Try this.
if mode.Value == 5 then --Color
RemoteEvent.OnServerEvent:Connect(function(player, data)
print("The vaule is 5")
if target.Locked == false then
print("target is locked")
target.Color = Color3(data)
print(data)
end
end)
end
Idk what kinda code the other dude gave.
If it hasn’t been brought up yet, i’m ninety percent sure Textlabel.text has to be set on the client, so it won’t replicate to the server. Trying to call it on the server will end in blank values.
Now you may look at this and think this is an error message.
But I look at this and see just success, this error message is not connected to the remote
event rather to something else.
Which line is line 93? Also show your full output box.
Print data before you attempt to set the target color.
There is no data, its just nothing.
Also this was line 93 (now its line 94): target.Color = Color3(data)
This is the code at the top (the original post). Let’s say a user types “0,255,0” into the TextBox. Couldn’t you use the following code to achieve what you wish?
if mode.Value == 5 then --Color
local colorinput = player.PlayerGui.LoadoutGui.Loadout.SpawnMenu.Loadout.RGB.Text
local colorsplit = string.split(colorinput, ",")
local notanumber = false
for _, color in pairs (colorsplit) do
if tonumber(color) or tonumber(color) > 255 or tonumber(color) < 0 then
notanumber = true
end
end
if notanumber then
return --or break depending on what it is
end
if target.Locked == false then
target.Color = Color3.fromRGB(colorsplit[1], colorsplit[2], colorsplit[3])
print(color)
end
end
end
Well apparently not since I get this error now.
Also yes in the textbox you are supposed to type “0,0,0” to get the color that you want.
When this error occured I typed in “0,255,0”.
Write a print(color)
right after the for statement.
By after, I mean inside, the first line inside. My bad for not clarifying.
Oh sure, gonna do that right now.
Also I removed the whole if statement, and the part just turned black no matter what RGB value I typed in.
I never thought I would waste 3 hours over a TextBox, but here we are.