How would I be able to change the color of a players tool?

Hello,
I’m trying to make a lightsaber customizer where you can change the color of a lightsaber and the way I was thinking of going about it was changing the color of a Particle Emitter when you touch a part but it is not working. Is there an easier way to do this?

Here’s my script

script.Parent.Touched:Connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	local tool = player.Backpack.Saber
	
	tool.Handle.Saber.SaberColor = Vector3.new(0,0,254)
end)
1 Like

for colors you must use Color3.new not Vector3.new
tool.Handle.Saber.SaberColor.Color = Color3.new(0,0,254)
Vector3 is used for positions.

Color3 is used for colors.

here if you wanna learn more about them :
Vector3

Color3

1 Like

Hello, thanks for posting. Vector3 is for position, the 3 values inside the bracket are (x,y,z). You would need to do Color3.new instead. :grin:

1 Like

Thank you, can’t believe I didn’t figure that out myself lol. I’m running into to problems one being

Saber is not a valid member of Backpack "Players.xxxXMadStudioXxxx1st.Backpack

and

SaberColor is not a valid member of Part 
"Players.xxxXMadStudioXxxx1st.Backpack.Saber.Handle.Saber
1 Like

tool.Handle.Saber.Color3 = Color3.fromRGB(0,0,254)

local tool = player:FindFirstChild('Backpack', true):FindFirstChild('Saber', false)
if tool then
   tool.Handle.Saber.Color3 = Color3.fromRGB(0,0,254)
end

script.Parent.Touched:Connect(function(hit)
	local player = game.Players:GetPlayerFromCharacter(hit.Parent)
	local tool = player.Backpack.Saber
	
	tool.Saber.SaberColor = Color3.fromRGB(0,0,254)
end)

You must have the tool in your backpack in order for it to work.