Im trying to change a part's color but its not working

Im trying to change a part’s color but its not working


game.ReplicatedStorage.SpawnPart.OnServerEvent:Connect(function(Player, Mouse)
	local part = Instance.new("Part", workspace)
	part.Anchored = true
	part.Position = Mouse.p
	part.Size = Vector3.new(5,5,5)
	
	part.Touched:Connect(function(hit)
		
		if hit.Parent:IsA("Part") then
			part.Color = hit.Parent.Color
		end
		
	end)
	
	game:GetService("Debris"):AddItem(part, 5)
end)
1 Like

Perhaps you meant hit:IsA("BasePart")(and hit.Color) or hit.Parent:IsA("BasePart")?

Also keep in mind if both the part and the hit are anchored, .Touched wont fire.

Sorry if this is very bad but maybe do
Game.Workspace.(Part name you want to use).color.(color)
Im sorry if this does not work I learned this from a tutorial

Or replace color with the name BrickColor

Brickcolors and color3s are a different thing. but thanks for help

hit.parent is the part i want to get color of