Hello! I am experiencing some issues with making the current color3 value darker.
This is the current global script in ServerScriptService.
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
char:FindFirstChild("Torso").BrickColor = BrickColor.random()
print("changed to", char:FindFirstChild("Torso").BrickColor)
char:FindFirstChild("Left Leg").Color = char:FindFirstChild("Torso").Color -- how to make it darker?
char:FindFirstChild("Right Leg").Color = char:FindFirstChild("Torso").Color -- how to make it darker?
end)
end)
Color returns a Color3, a Color3 has RGB properties, you can tweak these to however you want, though I think it would be best to do Color3:ToHSV() and lower the V since (I think) that’s the brightness
Example
local function changeBrightness(color)
local h, s, v = color:ToHSV()
return Color3.fromHSV(h, s, v/2) -- Here we half the brightness
end
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
char:FindFirstChild("Torso").BrickColor = BrickColor.random()
print("changed to", char:FindFirstChild("Torso").BrickColor)
char:FindFirstChild("Left Leg").Color = changeBrightness(char["Left Leg"].Color)
char:FindFirstChild("Right Leg").Color = changeBrightness(char["Right Leg"].Color)
end)
end)
Can you explain again? Are you talking about the BrickColor.random()? In that case, simply set the Color property of the Torso to be changeBrightness(BrickColor.random().Color)
You need to assign the changeBrightness to the Color property as well
local function changeBrightness(color)
local h, s, v = color:ToHSV()
return Color3.fromHSV(h, s, v/2) -- Here we half the brightness
end
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local chosenColor = BrickColor.random()
local darkenedColor = changeBrightness(chosenColor.Color)
char:FindFirstChild("Torso").BrickColor = chosenColor
print("changed to", char:FindFirstChild("Torso").BrickColor)
char:FindFirstChild("Left Leg").Color = darkenedColor
char:FindFirstChild("Right Leg").Color = darkenedColor
end)
end)