I can't get hsv to work

I am making a name changing gui for a Youtuber’s event where the player can
input a custom name and set the font and colour, everything works except for the colour bit itself.

	local h = (math.pi - math.atan2(colourPickerCentre.Y - centreOfWheel.Y, colourPickerCentre.X - centreOfWheel.X)) / (math.pi * 2)
	
	local s = (centreOfWheel - colourPickerCentre).Magnitude / (colourWheel.AbsoluteSize.X/2)
	
	local v = math.abs((darknessSlider.AbsolutePosition.Y - darknessPicker.AbsolutePosition.Y) / darknessPicker.AbsoluteSize.Y - 1)
	
	
	local hsv = Color3.fromHSV(math.clamp(h, 0, 1), math.clamp(s, 0, 1), math.clamp(v, 0, 1))
	
	
	colourDisplay.BackgroundColor3 = hsv

That is a short section of the code which sets the text label’s colour to the colour in the colour wheel so the player can see which colour they have selected, all of this works except for the remote event which sets the player’s nametag colour to the chosen one.

(This is the remote event firing)

script.Parent.MouseButton1Click:Connect(function()
	game.ReplicatedStorage.NameChange:FireServer(game.Players.LocalPlayer, script.Parent.Parent.Parent.CurrentColour.BackgroundColor3, script.Parent.Parent.Parent.NameInput.InputName.Text, script.Parent.Parent.Parent.NameInput.InputName.Font)
end)

(This is the actual script)

game.ReplicatedStorage.NameChange.OnServerEvent:Connect(function(_, player, colour, text, font)
	player.Character.Head.Tag.Nametag.Text = text.." ("..player.Name..")"
	player.Character.Head.Tag.Nametag.TextColor3 = Color3.fromHSV(colour)
	player.Character.Head.Tag.Nametag.Font = font
end)

It comes up with an error saying color3.fromHSV requires 3 arguments.

Change that to just colour, because what you passed in the remote event is already a Color3, no need to use the Color3 constructor again.

And why are you firing the local player in the remote event as an argument? The remote event automatically has the first passed argument as the player, no need to pass it yourself.

Change
_, player, colour, text, font
To:
player, colour, text, font

Change

game.ReplicatedStorage.NameChange:FireServer(game.Players.LocalPlayer, script.Parent.Parent.Parent.CurrentColour.BackgroundColor3, script.Parent.Parent.Parent.NameInput.InputName.Text, script.Parent.Parent.Parent.NameInput.InputName.Font)

To:

game.ReplicatedStorage.NameChange:FireServer(script.Parent.Parent.Parent.CurrentColour.BackgroundColor3, script.Parent.Parent.Parent.NameInput.InputName.Text, script.Parent.Parent.Parent.NameInput.InputName.Font)

Thanks so much for the help :grinning:

1 Like

I have updated the reply. Make sure to read it again.

1 Like