i am trying to get color3 value and set it as arg to the server and inside the server it will change it to everyone
i undarstand what you said but i just need it work like if the NameTagValue changed thenâŚ
it will send the change value to server and the color change
the color change coming with the nametag change it canât be changed without the nametag changed
Then you have to change the color before changing the nametag, because currently this is your code flow:
-- set nametag
NameTagValue.Value = "Newbie"
-- NameTagValue.Changed fired!
-- sending colour to the server...
-- set color (too late! the old colour has been sent instead of this one!)
ColorTag.Value = Color3.fromRGB(84, 135, 255)
you can see i tried it and still not work
when player clicking the button its changing the color and the name
then it goes to the local script and there goes the .changed part and then when its changed its need to see whats the color3 value in that moment.
-
player clicks button
1a. nametag value changed
1b. nametag text color value changed -
in the local script when it gets something changed in NameTagValue then its need to fire to server:
2a. current nametag value
2b. current nametag text color value
Your current flow:
- player clicks button
- nametag value changed
- NameTagValue is changed!!!
- sending current nametag value to server
- sending current text color value to server
- nametag text color value changed (too late, the old text color was just send to the server)
You have to change it to this:
- player clicks button
- nametag text color value changed
- nametag value changed
- NameTagValue is changed!!!
- sending current nametag value to server
- sending current text color value to server
https://gyazo.com/1c498c471a91736a5ff8b134646bb704
button script:
script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
local NameTagValue = player:FindFirstChild("NameTagToSave")
local ColorTag = NameTagValue:FindFirstChild("Color")
ColorTag.Value = Color3.fromRGB(84, 135, 255)
NameTagValue.Value = "Newbie"
end)
local script that fires to server the changes:
local player = game.Players.LocalPlayer
local NameTagValue = player:FindFirstChild("NameTagToSave")
local ColorValue = NameTagValue:FindFirstChild("Color").Value
local Event = game:GetService("ReplicatedStorage").NameTag
NameTagValue.Changed:Connect(function()
print(math.round(ColorValue.R * 255), math.round(ColorValue.G * 255), math.round(ColorValue.B * 255))
Event:FireServer(NameTagValue.Value)
end)
server script:
local Event = game:GetService("ReplicatedStorage").NameTag
Event.OnServerEvent:Connect(function(plr,TagValue,Color)
--print(Color)
script.Parent.Text = TagValue
script.Parent.TextColor3 = Color3.new(Color)
end)
do you see what happens in the video color is changing but the problem is in the local script that fires to server the changes.
its not getting the current color its changing in the video the name tag but the color isnât changing
You moved .Value
back outside of the event
It has to be in the event
When firing the server youâre not sending the color
Youâre trying to make a Color3
from a Color3
"Youâre trying to make a Color3
from a Color3
"
how can i set the color in the server script to be the color that is in the NameTagValue ?
could you help me with it please
Assuming you fired the server like so:
Event:FireServer(NameTagValue.Value, ColorValue.Value)
then
- plr: Player
- TagValue: string
- Color: Color3
Youâre basically doing this
local Color = Color3.fromRGB(84, 135, 255)
script.Parent.TextColor3 = Color3.new(Color)
Color
is already a Color3
, you do not have to turn it into a Color3
.
i am trying other way but still donât work
can you tell me why its not working?
server script:
local Event = game:GetService("ReplicatedStorage").NameTag
Event.OnServerEvent:Connect(function(plr,TagValue)
print(plr.NameTagToSave.Color.Value)
local color = Color3.fromRGB(math.round(plr.NameTagToSave.Color.Value.R * 255), math.round(plr.NameTagToSave.Color.Value.G * 255), math.round(plr.NameTagToSave.Color.Value.B * 255))
script.Parent.TextColor3 = color
script.Parent.Text = TagValue
--script.Parent.TextColor3 = Color3.new(math.round(ColorTag.R * 255), math.round(ColorTag.G * 255), math.round(ColorTag.B * 255))
end)
What about it isnât working?
30
Also why are you doing this?
just do
script.Parent.TextColor3 = plr.NameTagToSave.Color.Value
look:
local Event = game:GetService("ReplicatedStorage").NameTag
Event.OnServerEvent:Connect(function(plr,TagValue)
local r = math.round(plr.NameTagToSave.Color.Value.R * 255)
local g = math.round(plr.NameTagToSave.Color.Value.G * 255)
local b = math.round(plr.NameTagToSave.Color.Value.B * 255)
print(r)
print(g)
print(b)
--script.Parent.TextColor3 = Color3.fromRGB(r,g,b)
script.Parent.Text = TagValue
--script.Parent.TextColor3 = Color3.new(math.round(ColorTag.R * 255), math.round(ColorTag.G * 255), math.round(ColorTag.B * 255))
end)
from the prints above:
and when i do: âColor3.fromRGB(r,g,b)â
its not changing the color
i did not working not changing color
I donât find the point of converting from Color3.new to Color3.fromRGB.
If you do part.Color = color
it should change the color of the part to the color you put inside the value.
Hereâs what I did to convert the Color3.new to Color3.fromRGB.
local value = script.Parent.Value
print("Color3.new: "..value.R, value.G, value.B)
print("Color3.fromRGB: "..value.R * 255, value.G * 255, value.B * 255)
And it prints:
Could you show the structure of the ui above the player? In the Explorer view.